clockworklabs/SpacetimeDB · error · TypeError

Index ' ' on table ' ' is missing accessor name

Error message

Index '${idx.sourceName ?? '<unknown>'}' on table '${tableDef.sourceName}' is missing accessor name

What it means

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.

Solutions

  1. Pass --root-dir exactly once; prefer the single-token form --root-dir=<path>.
  2. If two layers both want to set it, resolve to one path before invoking the proxy.
  3. Remember args after '--' are not scanned, so passthrough CLI flags containing the literal text are safe.

Example fix

# before
spacetimedb-update --root-dir /srv/a --root-dir /srv/b publish

# after
spacetimedb-update --root-dir=/srv/a publish
Defensive patterns

Strategy: validation

Validate before calling

if (( $(grep -o -- '--root-dir' <<<"$SPACETIME_ARGS" | wc -l) > 1 )); then
  echo "--root-dir passed more than once"; exit 1
fi

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/1d46333e787c9c81. Report an issue: GitHub.

Appendix: source

Thrown at crates/bindings-typescript/src/lib/schema.ts:117

  AccName extends string,
  const T extends UntypedTableSchema,
>(
  accName: AccName,
  schema: T,
  tableDef: RawTableDefV10
): TableToSchema<AccName, T> {
  const getColName = (i: number) =>
    schema.rowType.algebraicType.value.elements[i].name;

  type AllowedCol = keyof T['rowType']['row'] & string;
  // Build fully-resolved runtime index metadata from the host-facing RawTableDef.
  // This is intentionally separate from `schema.idxs`, which keeps the original
  // user-declared `IndexOpts` shape for type-level inference.
  const resolvedIndexes: UntypedIndex<AllowedCol>[] = tableDef.indexes.map(
    idx => {
      const accessorName = idx.accessorName;
      if (typeof accessorName !== 'string' || accessorName.length === 0) {
        throw new TypeError(
          `Index '${idx.sourceName ?? '<unknown>'}' on table '${tableDef.sourceName}' is missing accessor name`
        );
      }

      const columnIds =
        idx.algorithm.tag === 'Direct'
          ? [idx.algorithm.value]
          : idx.algorithm.value;

      const unique = tableDef.constraints.some(
        c =>
          c.data.tag === 'Unique' &&
          c.data.value.columns.every(col => columnIds.includes(col))
      );

      const algorithm = (
        {
          BTree: 'btree',

View on GitHub (pinned to eddf9f5014)