{"record":{"id":"f4a0cae52b2e90a1","repo":"clockworklabs/SpacetimeDB","slug":"reschemaeventtable-table-table-name-not-found","errorCode":null,"errorMessage":"ReschemaEventTable: table `{table_name}` not found in new module def","messagePattern":"ReschemaEventTable: table `(.+?)` not found in new module def","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/engine/src/update.rs","lineNumber":558,"sourceCode":"            }\n            spacetimedb_schema::auto_migrate::AutoMigrateStep::ChangeColumns(table_name_key) => {\n                let (namespace, local) = table_name_key;\n                let table_name = joined(namespace, local);\n                let (owning_def, table_def) = plan.new.find_table(table_name_key).ok_or_else(|| {\n                    anyhow::anyhow!(\"ChangeColumns: table `{table_name}` not found in new module def\")\n                })?;\n                let table_id = stdb.table_id_from_name_mut(tx, &table_name).unwrap().unwrap();\n                let column_schemas = column_schemas_from_defs(owning_def, &table_def.columns, table_id);\n\n                log!(logger, \"Changing columns of table `{table_name}`\");\n\n                stdb.alter_table_row_type(tx, table_id, column_schemas)?;\n            }\n            spacetimedb_schema::auto_migrate::AutoMigrateStep::ReschemaEventTable(table_name_key) => {\n                let (namespace, local) = table_name_key;\n                let table_name = joined(namespace, local);\n                let (owning_def, table_def) = plan.new.find_table(table_name_key).ok_or_else(|| {\n                    anyhow::anyhow!(\"ReschemaEventTable: table `{table_name}` not found in new module def\")\n                })?;\n                let table_id = stdb.table_id_from_name_mut(tx, &table_name).unwrap().unwrap();\n                let column_schemas = column_schemas_from_defs(owning_def, &table_def.columns, table_id);\n\n                log!(logger, \"Changing schema of event table `{}`\", table_name);\n\n                stdb.alter_event_table_row_type(tx, table_id, column_schemas)?;\n            }\n            spacetimedb_schema::auto_migrate::AutoMigrateStep::ChangeAccess(table_name_key) => {\n                let (namespace, local) = table_name_key;\n                let table_name = joined(namespace, local);\n                let access = if let Some((_owning_def, table_def)) = plan.new.find_table(table_name_key) {\n                    table_def.table_access\n                } else {\n                    let (_owning_def, view_def) = plan.new.find_view(table_name_key).ok_or_else(|| {\n                        anyhow::anyhow!(\"ChangeAccess: `{table_name}` not found as a table or view in new module def\")\n                    })?;\n                    if view_def.is_public {","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/engine/src/update.rs#L540-L576","documentation":"ReschemaEventTable rewrites the row type of a system event table (st_<table>_inserts/_deletes, e.g. backing scheduled tables) when the module's row type changes. plan.new.find_table fails, so the new column schemas cannot be derived - the step's table key does not resolve in the new module def. The publish aborts.","triggerScenarios":"Changing a scheduled table's row type while renaming or moving it in the same publish; scheduler/event-table naming drift after compiler version changes; def/plan desync from stale artifacts.","commonSituations":"Editing fields of #[spacetimedb::table(scheduled = ...)] reducer tables together with renames; upgrading between spacetimedb versions that changed event-table naming.","solutions":["Clean-rebuild and republish.","Change the scheduled table's fields in a dedicated publish with the table name/path unchanged.","Keep scheduled table names pinned; rename them in separate publishes.","Align toolchain versions before touching scheduled tables.","Dev: spacetime publish --delete-data <db>.","Report with the scheduled-table definition if it persists."],"exampleFix":"// before: change a scheduled table's row type AND rename it in one publish\n#[spacetimedb::table(name = \"tick_new\", scheduled(tick_old_reducer))]\npub struct TickNew { pub count: u64 }\n\n// after: two publishes\n// 1) add/modify columns keeping name `tick`\n#[spacetimedb::table(name = \"tick\", scheduled(tick_reducer))]\npub struct Tick { pub count: u64 }\n// 2) rename separately","handlingStrategy":"validation","validationCode":"use spacetimedb_schema::auto_migrate::AutoMigrateStep;\nfor step in &plan.steps {\n    if let AutoMigrateStep::ReschemaEventTable(key) = step {\n        if plan.new.find_table(key).is_none() {\n            anyhow::bail!(\"ReschemaEventTable step references table {:?} missing from new def\", key);\n        }\n    }\n}","typeGuard":"fn event_table_in_new_def(plan: &AutoMigratePlan, key: (&str, &str)) -> bool {\n    plan.new.find_table(key).is_some()\n}","tryCatchPattern":"match update_database(&stdb, tx, &plan, ...).await {\n    Err(e) if e.to_string().contains(\"ReschemaEventTable\") => {\n        // Split: change the scheduled table's row type with its name untouched first.\n    }\n    result => result?,\n}","preventionTips":["Keep scheduled table names stable when changing their fields.","Publish scheduled-table row-type changes alone.","Align toolchain versions before touching scheduled tables.","Clean-build before republishing after upgrades."],"tags":["spacetimedb","rust","schema-migration","event-table","scheduled","publish"],"backgroundTag":"schema-migration-plan-mismatch","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}