{"record":{"id":"abef82a7a13777cf","repo":"clockworklabs/SpacetimeDB","slug":"unknown-anonviewid-id","errorCode":null,"errorMessage":"unknown anonViewId ${id}","messagePattern":"unknown anonViewId (.+?)","errorType":"exception","errorClass":"RangeError","httpStatus":null,"severity":"critical","filePath":"crates/bindings-typescript/src/server/runtime.ts","lineNumber":674,"sourceCode":"      localId = id;\n      dbView = this.#dbView as ReadonlyDbView<any>;\n      from = makeQueryBuilder(moduleCtx.schemaType);\n    } else {\n      let offset = this.#consumerAnonViewCount;\n      let found = false;\n      for (let i = 0; i < this.#flatSubmodules.length; i++) {\n        const m = this.#flatSubmodules[i];\n        if (id < offset + m.anonViewFns.length) {\n          anonViewFns = m.anonViewFns;\n          localId = id - offset;\n          dbView = this.#getSubmoduleDbView(i) as ReadonlyDbView<any>;\n          from = this.#getSubmoduleQueryBuilder(i);\n          found = true;\n          break;\n        }\n        offset += m.anonViewFns.length;\n      }\n      if (!found) throw new RangeError(`unknown anonViewId ${id}`);\n    }\n\n    const { fn, deserializeParams, serializeReturn, returnTypeBaseSize } =\n      anonViewFns![localId!];\n    const ctx: AnonymousViewCtx<any> = freeze({\n      db: dbView!,\n      from: from!,\n    });\n    const args = deserializeParams(new BinaryReader(argsBuf));\n    const ret = callUserFunction(fn, ctx, args);\n    const retBuf = new BinaryWriter(returnTypeBaseSize);\n    if (isRowTypedQuery(ret)) {\n      const query = toSql(ret);\n      ViewResultHeader.serialize(retBuf, ViewResultHeader.RawSql(query));\n    } else {\n      ViewResultHeader.serialize(retBuf, ViewResultHeader.RowData);\n      serializeReturn(retBuf, ret);\n    }","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/bindings-typescript/src/server/runtime.ts#L656-L692","documentation":"Anonymous views (callable without a caller identity) are dispatched by numeric id against the flattened anonViewFns arrays of the module and its submodules. If the id is outside every submodule's range, dispatch throws RangeError('unknown anonViewId <n>'): the host's idea of the anonymous-view table does not match the deployed module.","triggerScenarios":"The host calls an anonymous view id that was removed or reordered by a redeploy; submodule anonymous-view sets differ between the host's build and the deployed module.","commonSituations":"Redeploying with changed anonymous views while stale host state or old generated bindings persist; version skew between host and module toolchain.","solutions":["Redeploy the module and regenerate all bindings so anonymous-view ids match","Only append new anonymous views between deploys; never reorder or remove existing ones","Align host/SDK versions and confirm the deployed module hash matches what you generated against"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep anonymous view ordering stable across deploys; append rather than modify","Regenerate bindings and redeploy as one atomic release step","Confirm host/module version alignment (module hash) before routing traffic"],"tags":["dispatch","schema-mismatch","view","typescript"],"backgroundTag":"unknown-dispatch-id","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}