{"record":{"id":"760b65d22544af17","repo":"clockworklabs/SpacetimeDB","slug":"missing-system-table-sequence-id-for-sequence-o","errorCode":null,"errorMessage":"missing system table sequence id for sequence {} of table {}","messagePattern":"missing system table sequence id for sequence (.+?) of table (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/datastore/src/system_tables.rs","lineNumber":846,"sourceCode":"        });\n    }\n    for constraint in &mut result.constraints {\n        constraint.constraint_id = CONSTRAINT_IDS\n            .get(&constraint.constraint_name[..])\n            .copied()\n            .unwrap_or_else(|| {\n                panic!(\n                    \"missing system table constraint id for constraint {} of table {}\",\n                    constraint.constraint_name, result.table_name\n                )\n            });\n    }\n    for sequence in &mut result.sequences {\n        sequence.sequence_id = SEQUENCE_IDS\n            .get(&sequence.sequence_name[..])\n            .copied()\n            .unwrap_or_else(|| {\n                panic!(\n                    \"missing system table sequence id for sequence {} of table {}\",\n                    sequence.sequence_name, result.table_name\n                )\n            });\n        sequence.start = ST_RESERVED_SEQUENCE_RANGE as i128 + 1;\n        // sequence.allocated = ST_RESERVED_SEQUENCE_RANGE as i128;\n    }\n    if let Some(sch) = result.schedule {\n        panic!(\n            \"system tables cannot have schedules, but table {}: {sch:?}\",\n            result.table_name\n        );\n    }\n    result.normalize();\n    // Note, if we ever added system tables with schedules, we would need to set their IDs here too.\n    result\n}\n","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/datastore/src/system_tables.rs#L828-L864","documentation":"SpacetimeDB constructs its system-table schemas at startup and, in the normalizer, assigns every sequence attached to a system table a reserved id from the static SEQUENCE_IDS registry (mirroring the constraint-id lookup just above it). If a system table's sequence name is missing from that map, the code panics; the normalizer also forces sequence.start into the ST_RESERVED_SEQUENCE_RANGE. This is an internal registration invariant reachable only by code that defines system tables (spacetimedb core or a fork), not by user DDL.","triggerScenarios":"A developer adds a system table with a sequence but does not register its name in the SEQUENCE_IDS map in system_tables.rs; panics during system schema construction at boot or in datastore tests.","commonSituations":"Contributing new system tables to spacetimedb core; custom forks adding system tables; rebasing across refactors that renamed sequences without updating the registry.","solutions":["Add the sequence name and a unique reserved id to SEQUENCE_IDS alongside the other system sequence registrations.","Or remove the sequence from that system table's schema.","Run the datastore/system-table tests, which construct every system table and will catch the miss."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// core devs: registry-completeness test next to SEQUENCE_IDS\n#[test]\nfn all_system_table_sequences_registered() {\n    for st in system_tables() {\n        for seq in &st.sequences {\n            assert!(\n                SEQUENCE_IDS.contains_key(&seq.sequence_name[..]),\n                \"unregistered system sequence {}\",\n                seq.sequence_name\n            );\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"// keep boot-time panics from failing silently in CI\nlet r = std::panic::catch_unwind(build_system_tables);\nif r.is_err() {\n    // a system table sequence lacks a reserved id: fix SEQUENCE_IDS before merging\n}","preventionTips":["Add a registry-completeness test beside SEQUENCE_IDS.","Run the system-table test suite whenever adding tables or sequences.","Code-review rule: a new system table sequence requires a reserved id in the same PR."],"tags":["spacetimedb","system-tables","internal","boot","invariant"],"backgroundTag":"system-table-invariant","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}