{"record":{"id":"4dace98e3adc8938","repo":"unionlabs/union","slug":"not-a-moveobject","errorCode":null,"errorMessage":"Not a MoveObject","messagePattern":"Not a MoveObject","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts-sdk-sui/src/internal/zkgmClient.ts","lineNumber":42,"sourceCode":"\ntype HexAddr = `0x${string}`\nconst base58ToHex = (s: string): Hex => toHex(bs58.decode(s)) as Hex\n\ninterface Port {\n  id: { id: HexAddr }\n  _module_address: HexAddr\n  data: HexAddr\n}\n\nexport const readUcs03Port = (client: SuiClient, portId: string) =>\n  Effect.tryPromise({\n    try: () =>\n      client.getObject({\n        id: portId,\n        options: { showContent: true },\n      }).then(async res => {\n        if (res.data?.content?.dataType !== \"moveObject\") {\n          throw new Error(\"Not a MoveObject\")\n        }\n\n        const f = res.data.content.fields as unknown as Port\n\n        return {\n          ucs03Address: f._module_address,\n          module: \"zkgm\",\n          relayStoreId: f.data,\n        }\n      }),\n    catch: error => error,\n  })\n\nexport const fromWallet = (\n  opts: { client: Sui.Sui.PublicClient; wallet: Sui.Sui.WalletClient },\n): Client.ZkgmClient =>\n  Client.make((request, signal, fiber) =>\n    Effect.gen(function*() {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/ts-sdk-sui/src/internal/zkgmClient.ts#L24-L60","documentation":"readUcs03Port fetches the UCS03 port object on Sui with { showContent: true } and requires res.data.content.dataType === \"moveObject\" before casting fields to the Port shape. If the id resolves to no data (missing object), a package, or a wrapped/deleted object, the guard fails and throws.","triggerScenarios":"A portId that is wrong for the network being queried (testnet/mainnet mixup); the port object not yet created on an early-stage chain; the object deleted or wrapped since deployment; a truncated/malformed object id.","commonSituations":"Hardcoded per-network port addresses drifting out of sync; config shipped before the port contract was deployed; pointing the SDK at a different RPC network than the addresses assume.","solutions":["Look the portId up in the Sui explorer for the same network and confirm the object exists","Run `sui client object <portId>` and verify the output shows dataType: moveObject","Align the SDK/client network with the deployed port addresses in config"],"exampleFix":"// before\nif (res.data?.content?.dataType !== \"moveObject\") {\n  throw new Error(\"Not a MoveObject\")\n}\n\n// after\nconst content = res.data?.content\nif (!content || content.dataType !== \"moveObject\") {\n  throw new Error(\n    `UCS03 port ${portId} is not a MoveObject (dataType=${content?.dataType ?? \"missing\"})`,\n  )\n}","handlingStrategy":"try-catch","validationCode":"// pre-check the object exists and is a Move object before reading the port\nconst res = await client.getObject({ id: portId, options: { showContent: true } })\nconst ok = res.data?.content?.dataType === \"moveObject\"\nif (!ok) console.warn(`Port ${portId} missing or not a MoveObject on this network`)","typeGuard":"const isMoveObjectContent = (\n  c: { dataType?: string } | undefined,\n): c is { dataType: \"moveObject\"; fields: Record<string, unknown> } =>\n  c?.dataType === \"moveObject\"","tryCatchPattern":"const result = await Effect.runPromiseExit(readUcs03Port(client, portId))\nif (Exit.isFailure(result)) {\n  // verify the id in the explorer / sui client object <portId> before retrying\n  throw new Error(`UCS03 port ${portId} not readable — check network and object id`)\n}","preventionTips":["Pin per-network port addresses in one config source and validate against the RPC network","Smoke-test object ids (sui client object <id>) after deployments","Surface dataType in error logs to distinguish missing vs wrong-type objects"],"tags":["sui","rpc","object","ucs03"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}