You need a ctxt.Throw() here (this will throw the appropriate error from the failure of MCStringEncode)