{"record":{"id":"1d46333e787c9c81","repo":"clockworklabs/SpacetimeDB","slug":"index-idx-sourcename-unknown-on-table","errorCode":null,"errorMessage":"Index '${idx.sourceName ?? '<unknown>'}' on table '${tableDef.sourceName}' is missing accessor name","messagePattern":"Index '(.+?)' on table '(.+?)' is missing accessor name","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/lib/schema.ts","lineNumber":117,"sourceCode":"  AccName extends string,\n  const T extends UntypedTableSchema,\n>(\n  accName: AccName,\n  schema: T,\n  tableDef: RawTableDefV10\n): TableToSchema<AccName, T> {\n  const getColName = (i: number) =>\n    schema.rowType.algebraicType.value.elements[i].name;\n\n  type AllowedCol = keyof T['rowType']['row'] & string;\n  // Build fully-resolved runtime index metadata from the host-facing RawTableDef.\n  // This is intentionally separate from `schema.idxs`, which keeps the original\n  // user-declared `IndexOpts` shape for type-level inference.\n  const resolvedIndexes: UntypedIndex<AllowedCol>[] = tableDef.indexes.map(\n    idx => {\n      const accessorName = idx.accessorName;\n      if (typeof accessorName !== 'string' || accessorName.length === 0) {\n        throw new TypeError(\n          `Index '${idx.sourceName ?? '<unknown>'}' on table '${tableDef.sourceName}' is missing accessor name`\n        );\n      }\n\n      const columnIds =\n        idx.algorithm.tag === 'Direct'\n          ? [idx.algorithm.value]\n          : idx.algorithm.value;\n\n      const unique = tableDef.constraints.some(\n        c =>\n          c.data.tag === 'Unique' &&\n          c.data.value.columns.every(col => columnIds.includes(col))\n      );\n\n      const algorithm = (\n        {\n          BTree: 'btree',","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/bindings-typescript/src/lib/schema.ts#L99-L135","documentation":"Before exec'ing the real CLI, the updater proxy hand-scans its own argv for --root-dir (accepted as '--root-dir VALUE' or '--root-dir=VALUE', scanning stops at '--'). The argument is single-valued, so a second occurrence is rejected, mirroring clap's 'cannot be used multiple times' behavior for non-multiple args.","triggerScenarios":"Any invocation passing --root-dir twice before '--': spacetimedb-update --root-dir /a --root-dir /b ..., including mixed forms like --root-dir=/a --root-dir /b.","commonSituations":"Wrapper scripts or CI templates that append --root-dir without checking existing args; environment wrappers (alias/direnv hooks) injecting the flag on top of user input.","solutions":["Pass --root-dir exactly once; prefer the single-token form --root-dir=<path>.","If two layers both want to set it, resolve to one path before invoking the proxy.","Remember args after '--' are not scanned, so passthrough CLI flags containing the literal text are safe."],"exampleFix":"# before\nspacetimedb-update --root-dir /srv/a --root-dir /srv/b publish\n\n# after\nspacetimedb-update --root-dir=/srv/a publish","handlingStrategy":"validation","validationCode":"if (( $(grep -o -- '--root-dir' <<<\"$SPACETIME_ARGS\" | wc -l) > 1 )); then\n  echo \"--root-dir passed more than once\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the single-token form --root-dir=<path> in scripts and templates.","Have wrappers replace, not append, the root-dir argument.","Put passthrough CLI flags after '--' so the proxy's pre-scan ignores them."],"tags":["spacetimedb","cli","command-line-arguments","proxy"],"backgroundTag":"duplicate-cli-argument","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}