{"record":{"id":"6f6af5cb61192ca1","repo":"clockworklabs/SpacetimeDB","slug":"uint8array-is-not-16-bytes-long-array","errorCode":null,"errorMessage":"Uint8Array is not 16 bytes long: ${array}","messagePattern":"Uint8Array is not 16 bytes long: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/lib/util.ts","lineNumber":48,"sourceCode":"  // Check all keys and compare values recursively\n  for (const key of keys1) {\n    if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nexport function uint8ArrayToHexString(array: Uint8Array): string {\n  return Array.prototype.map\n    .call(array.reverse(), x => ('00' + x.toString(16)).slice(-2))\n    .join('');\n}\n\nexport function uint8ArrayToU128(array: Uint8Array): bigint {\n  if (array.length != 16) {\n    throw new Error(`Uint8Array is not 16 bytes long: ${array}`);\n  }\n  return new BinaryReader(array).readU128();\n}\n\nexport function uint8ArrayToU256(array: Uint8Array): bigint {\n  if (array.length != 32) {\n    throw new Error(`Uint8Array is not 32 bytes long: [${array}]`);\n  }\n  return new BinaryReader(array).readU256();\n}\n\nexport function hexStringToUint8Array(str: string): Uint8Array {\n  if (str.startsWith('0x')) {\n    str = str.slice(2);\n  }\n  const matches = str.match(/.{1,2}/g) || [];\n  const data = Uint8Array.from(\n    matches.map((byte: string) => parseInt(byte, 16))","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-typescript/src/lib/util.ts#L30-L66","documentation":"find_column resolves an identifier used by index arguments (and the scheduled at = ... column) against the table struct's field identifiers. If no field matches, the attribute references a column that does not exist on this table; the syn error is spanned to the offending identifier.","triggerScenarios":"#[index(btree = [status])] on a table whose field is named state; scheduled(my_reducer, at = run_at) with no run_at field; referencing an on-chain column name (from a column rename attribute) instead of the Rust field ident.","commonSituations":"Renaming a field without updating index attributes; leftover attributes after deleting a field; using the SATS/on-chain column name where the macro expects the Rust ident.","solutions":["Fix the identifier to match the Rust field name exactly.","After renaming any field, grep the crate for its old name in index(...)/scheduled(...) attributes.","Remember the lookup uses field idents, not on-chain column names."],"exampleFix":"// before\npub struct Order { pub state: String }\n#[spacetimedb::table(index(btree = [status]))]\n                         // ^ no field named `status`\n\n// after\n#[spacetimedb::table(index(btree = [state]))]\npub struct Order { pub state: String }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["After renaming any table field, grep for the old ident inside index(...) and scheduled(...) attributes.","Reference Rust field idents in macro attributes, not on-chain column names.","Delete index attributes together with the fields they name."],"tags":["spacetimedb","proc-macro","index","column","compile-time"],"backgroundTag":"unknown-column-reference","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}