clockworklabs/SpacetimeDB · critical · RangeError

unknown procedureId ${id}

Error message

unknown procedureId ${id}

What it means

Procedures are dispatched by numeric id across the flattened procedureFns of the module and submodules (including nested sub-dispatches with name prefixes). When no submodule claims the id, the loop completes and dispatch throws RangeError('unknown procedureId <n>'): the host and the deployed module disagree about the procedure table.

Source

Thrown at crates/bindings-typescript/src/server/runtime.ts:739

    for (let i = 0; i < this.#flatSubmodules.length; i++) {
      const m = this.#flatSubmodules[i];
      if (id < offset + m.procedureFns.length) {
        return callProcedure(
          m.procedureFns,
          id - offset,
          senderIdentity,
          connId,
          ts,
          args,
          () => this.#getSubmoduleDbView(i),
          m.subDispatches,
          m.namePrefix
        );
      }
      offset += m.procedureFns.length;
    }

    throw new RangeError(`unknown procedureId ${id}`);
  }

  __call_http_handler__(
    id: u32,
    timestamp: bigint,
    request: Uint8Array,
    body: Uint8Array
  ): [response: Uint8Array, body: Uint8Array] {
    const moduleCtx = this.#schema;
    const handler = moduleCtx.httpHandlers[id];
    const ctx = new HandlerContextImpl(
      new Timestamp(timestamp),
      () => this.#dbView,
      this.#schema.submoduleDispatchInfos
    );
    const requestMetadata = HttpRequest.deserialize(new BinaryReader(request));
    const response = callUserFunction(
      handler,

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Redeploy the module and regenerate bindings so procedure ids are consistent
  2. Append new procedures instead of reordering or removing existing ones between deploys
  3. Align spacetimedb host, hosttools and SDK versions; verify the module hash after deploy
  4. If it persists after a clean redeploy, report with module hash and host version
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: The host invokes a procedure id that does not exist in the deployed build: module redeployed with procedures removed/reordered while host state or generated callers reference old ids; submodule procedure sets changed between builds.

Common situations: Redeploying a module with changed procedures without regenerating callers; partial deploy or rollback leaving host and module out of sync; hosttools/SDK/server version mismatch.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/d2271afd11c91a0c. Report an issue: GitHub.