{"record":{"id":"16e35f4a0496e090","repo":"clockworklabs/SpacetimeDB","slug":"scheduled-table-table-id-doesn-t-have-valid-colu","errorCode":null,"errorMessage":"scheduled table {table_id} doesn't have valid columns","messagePattern":"scheduled table (.+?) doesn't have valid columns","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/core/src/host/scheduler.rs","lineNumber":113,"sourceCode":"\n        // Draining rx before processing schedules from the DB to ensure there are no in-flight messages,\n        // as this can result in duplication.\n        //\n        // Explanation: By this time, if the `Scheduler::schedule` method has been called (the `init` reducer can do that),\n        // there will be an in-flight message in tx that has already been inserted into the DB.\n        // We are building the `queue` below with the DB and then spawning `SchedulerActor`, which will processes\n        // the in-flight message, resulting in a duplicate entry in the queue.\n        while self.rx.try_recv().is_ok() {}\n\n        // Find all Scheduled tables\n        for st_scheduled_row in self.db.iter(&tx, ST_SCHEDULED_ID)? {\n            let table_id = st_scheduled_row.read_col(StScheduledFields::TableId)?;\n            let function_name =\n                Arc::<str>::from(st_scheduled_row.read_col::<Box<str>>(StScheduledFields::ReducerName)?);\n            let (id_column, at_column) = self\n                .db\n                .table_scheduled_id_and_at(&tx, table_id)?\n                .ok_or_else(|| anyhow!(\"scheduled table {table_id} doesn't have valid columns\"))?;\n\n            let now_ts = Timestamp::now();\n            let now_instant = Instant::now();\n\n            // Insert each entry (row) in the scheduled table into `queue`.\n            for scheduled_row in self.db.iter(&tx, table_id)? {\n                let (schedule_id, schedule_at) = get_schedule_from_row(&scheduled_row, id_column, at_column)?;\n                let row_hash = scheduled_row_hash(&scheduled_row)?;\n                // calculate duration left to call the scheduled reducer\n                let duration = schedule_at.to_duration_from(now_ts);\n                let at = schedule_at.to_timestamp_from(now_ts);\n                let id = ScheduledFunctionId {\n                    table_id,\n                    schedule_id,\n                    id_column,\n                    at_column,\n                };\n                queue.insert_at(","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/core/src/host/scheduler.rs#L95-L131","documentation":"On scheduler startup the host enumerates every table registered in st_scheduled and requires each to expose the generated scheduled id and at columns via table_scheduled_id_and_at. A None result means the scheduled table's stored schema is invalid - the columns every #[spacetimedb::table(scheduled)] table must have are missing, and the scheduler cannot build its queue.","triggerScenarios":"A publish where a scheduled table lost its generated columns (corrupt schema rows); a crashed publish leaving partial st_scheduled entries; schema written by a mismatched or older SDK.","commonSituations":"Host or SDK version downgrade across a database's lifetime; interrupted publishes in CI; hand-edited or restored-from-backup catalog rows.","solutions":["Republish the module so the scheduled table schema is regenerated.","Verify the module uses #[spacetimedb::table(scheduled)] from the current SDK and builds cleanly.","If metadata is corrupt, recreate the database from a clean publish.","Capture the st_scheduled and table schema rows and report if the problem reproduces."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Treat scheduler startup failure with this message as fatal for the database: stop, validate or republish the schema, then restart - retrying unchanged keeps failing.","preventionTips":["Never hand-write scheduled-table columns; let the macro/SDK generate them.","Pin one SDK version across build and host.","Smoke-test publish on staging data before production."],"tags":["scheduled","table","schema","scheduler","startup"],"backgroundTag":"invalid-table-schema","analyzedSha":"fdd647dfac506d0967cc4492e9fce380706c94cb","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}