{"record":{"id":"872f7788f322de56","repo":"clockworklabs/SpacetimeDB","slug":"schedule-target-table-is-not-part-of-this-schema","errorCode":null,"errorMessage":"Schedule target table is not part of this schema.","messagePattern":"Schedule target table is not part of this schema\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/server/schema.ts","lineNumber":171,"sourceCode":"    for (const {\n      functionName: knownFunctionName,\n      reducer,\n      table,\n      tableName: knownTableName,\n      scheduleAtCol: knownScheduleAtCol,\n    } of this.pendingSchedules) {\n      let tableName = knownTableName;\n      if (tableName === undefined) {\n        const tableNames = this.tableSourceNames.get(table);\n        if (tableNames !== undefined && tableNames.length > 1) {\n          throw new TypeError(\n            'Schedule target table is registered more than once in this schema. Use a distinct table handle for each scheduled table.'\n          );\n        }\n        tableName = tableNames?.[0];\n      }\n      if (tableName === undefined) {\n        throw new TypeError(\n          'Schedule target table is not part of this schema.'\n        );\n      }\n\n      const scheduleAtCol = knownScheduleAtCol ?? table.scheduleAtCol;\n      if (scheduleAtCol === undefined) {\n        throw new TypeError(\n          `Table ${tableName} defines a schedule, but it does not have a ScheduleAt column.`\n        );\n      }\n\n      const functionName =\n        knownFunctionName ??\n        (reducer === undefined\n          ? undefined\n          : this.functionExports.get(reducer()));\n      if (functionName === undefined) {\n        const msg = `Table ${tableName} defines a schedule, but it seems like the associated function was not exported.`;","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/bindings-typescript/src/server/schema.ts#L153-L189","documentation":"During `resolveSchedules`, each pending schedule must be tied to a table that is part of the schema. If neither an explicit name was supplied nor the table object found in `tableSourceNames`, the schedule target is unknown to this schema and the build fails with 'Schedule target table is not part of this schema.' The scheduled reducer/procedure's payload table must appear in the object passed to `schema({...})`.","triggerScenarios":"Calling `spacetimedb.reducer({ onSchedule: someTable }, ...)` where `someTable` was created with `table()` but not listed in the schema entries object; defining the scheduled table in a different schema instance; passing a table-like object that was never registered.","commonSituations":"Extracting scheduled reducers into a library file while the table lives (unregistered) in another module; forgetting to add the new schedule table to the schema entries after introducing a scheduled reducer; renaming the schema entry so the mapping is lost.","solutions":["Add the schedule target table to the schema entries: `export default schema({ scheduledMessages, ... })` using the same handle you passed to `onSchedule`.","Ensure the table handle passed to `onSchedule` is the very same object registered in the schema (identity matters, not just an identical row shape).","If the table comes from a shared library, import that library's table handle and register it once in this schema."],"exampleFix":"// before\nconst scheduledMessages = table({}, row);\nconst processMsg = spacetimedb.reducer(\n  { onSchedule: scheduledMessages }, {...}, handler\n);\nexport default schema({ users }); // scheduledMessages missing\n\n// after\nexport default schema({ users, scheduledMessages });","handlingStrategy":"validation","validationCode":"// Dev-time: every onSchedule table must also be a schema entry.\nconst schemaTables = new Set<unknown>([users, orders, scheduledMessages]);\nfunction onScheduleTableIsRegistered(t: unknown) {\n  if (!schemaTables.has(t)) throw new Error('schedule table missing from schema entries');\n}\n// spacetimedb.reducer({ onSchedule: scheduledMessages }, ...); with scheduledMessages in the set","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define each scheduled table immediately next to the schema entry that registers it.","Import table handles from a single `tables.ts` so identity is shared, not recreated.","When adding a scheduled reducer, add its table to the schema entries in the same commit."],"tags":["scheduling","schema","tables","build-time","spacetimedb"],"backgroundTag":"table-not-in-schema","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"}