clockworklabs/SpacetimeDB · critical · anyhow::Error

scheduled table doesn't have valid columns

Error message

scheduled table {table_id} doesn't have valid columns

What it means

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.

Solutions

  1. Republish the module so the scheduled table schema is regenerated.
  2. Verify the module uses #[spacetimedb::table(scheduled)] from the current SDK and builds cleanly.
  3. If metadata is corrupt, recreate the database from a clean publish.
  4. Capture the st_scheduled and table schema rows and report if the problem reproduces.
Defensive patterns

Strategy: try-catch

Try / catch

Treat scheduler startup failure with this message as fatal for the database: stop, validate or republish the schema, then restart - retrying unchanged keeps failing.

Prevention

When it happens

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

Common situations: Host or SDK version downgrade across a database's lifetime; interrupted publishes in CI; hand-edited or restored-from-backup catalog rows.

Related errors


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

Appendix: source

Thrown at crates/core/src/host/scheduler.rs:113

        // Draining rx before processing schedules from the DB to ensure there are no in-flight messages,
        // as this can result in duplication.
        //
        // Explanation: By this time, if the `Scheduler::schedule` method has been called (the `init` reducer can do that),
        // there will be an in-flight message in tx that has already been inserted into the DB.
        // We are building the `queue` below with the DB and then spawning `SchedulerActor`, which will processes
        // the in-flight message, resulting in a duplicate entry in the queue.
        while self.rx.try_recv().is_ok() {}

        // Find all Scheduled tables
        for st_scheduled_row in self.db.iter(&tx, ST_SCHEDULED_ID)? {
            let table_id = st_scheduled_row.read_col(StScheduledFields::TableId)?;
            let function_name =
                Arc::<str>::from(st_scheduled_row.read_col::<Box<str>>(StScheduledFields::ReducerName)?);
            let (id_column, at_column) = self
                .db
                .table_scheduled_id_and_at(&tx, table_id)?
                .ok_or_else(|| anyhow!("scheduled table {table_id} doesn't have valid columns"))?;

            let now_ts = Timestamp::now();
            let now_instant = Instant::now();

            // Insert each entry (row) in the scheduled table into `queue`.
            for scheduled_row in self.db.iter(&tx, table_id)? {
                let (schedule_id, schedule_at) = get_schedule_from_row(&scheduled_row, id_column, at_column)?;
                let row_hash = scheduled_row_hash(&scheduled_row)?;
                // calculate duration left to call the scheduled reducer
                let duration = schedule_at.to_duration_from(now_ts);
                let at = schedule_at.to_timestamp_from(now_ts);
                let id = ScheduledFunctionId {
                    table_id,
                    schedule_id,
                    id_column,
                    at_column,
                };
                queue.insert_at(

View on GitHub (pinned to fdd647dfac)