{"record":{"id":"8f6b18ec5cea7992","repo":"clockworklabs/SpacetimeDB","slug":"a-row-was-a-sequence-trigger-but-there-was-no-gene","errorCode":null,"errorMessage":"a row was a sequence trigger but there was no generated column for it.","messagePattern":"a row was a sequence trigger but there was no generated column for it\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bindings/src/table.rs","lineNumber":1295,"sourceCode":"    /// Is this value one that will trigger a sequence, if any,\n    /// when used as a column value.\n    /// For numeric types, this is `0`.\n    fn is_sequence_trigger(&self) -> bool;\n    /// Should invoke `BufReader::get_{Self}`, for example `BufReader::get_u32`.\n    fn decode(reader: &mut &[u8]) -> Result<Self, DecodeError>;\n    /// Read a generated column from the slice, if this row was a sequence trigger.\n    #[inline(always)]\n    fn maybe_decode_into(&mut self, gen_cols: &mut &[u8]) {\n        if self.is_sequence_trigger() {\n            *self = Self::decode(gen_cols).unwrap_or_else(|_| sequence_decode_error())\n        }\n    }\n}\n\n#[cold]\n#[inline(never)]\nfn sequence_decode_error() -> ! {\n    unreachable!(\"a row was a sequence trigger but there was no generated column for it.\")\n}\n\nmacro_rules! impl_seq_trigger {\n    ($($get:ident($t:ty),)*) => {\n        $(\n            impl SequenceTrigger for $t {\n                #[inline(always)]\n                fn is_sequence_trigger(&self) -> bool { *self == 0 }\n                #[inline(always)]\n                fn decode(reader: &mut &[u8]) -> Result<Self, DecodeError> {\n                    reader.$get()\n                }\n            }\n        )*\n    };\n}\n\nimpl_seq_trigger!(","sourceCodeStart":1277,"sourceCodeEnd":1313,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings/src/table.rs#L1277-L1313","documentation":"Panics while decoding a BSATN table row in the generated client bindings. A row whose encoding marks it as a sequence trigger (a placeholder where a generated/sequence column value belongs) must be completed from the generated-columns byte slice, but `Self::decode(gen_cols)` failed — typically because the slice is empty or shorter than the value. In practice the binary payload does not match the schema the bindings were generated from.","triggerScenarios":"Decoding a subscription table update or query result whose BSATN rows contain sequence-trigger markers while the generated-columns slice is empty or truncated. Happens when bindings were generated from a different module schema than the server publishes (e.g. a column gained sequence/auto-inc generation) or when the byte buffer was sliced incorrectly.","commonSituations":"Stale generated bindings after redeploying a module with schema changes; a client built against module version A talking to a database running version B; truncated or corrupted WebSocket/HTTP payloads introduced by a proxy.","solutions":["Regenerate the module bindings against the currently published module (`spacetime generate`) so the row layout matches","Redeploy the module so server and client agree on the schema, then rebuild the client","Verify the transport is not truncating frames (proxy/load-balancer body limits) and that both sides target the same database"],"exampleFix":"# before\n# client decodes subscription updates with bindings generated from an old schema:\n# panic: a row was a sequence trigger but there was no generated column for it.\n\n# after\nspacetime generate --lang rust --out-dir ./module-bindings\n# then rebuild the client against the refreshed bindings","handlingStrategy":"validation","validationCode":"// before subscribing, confirm the client's schema matches the published module\nlet remote = api.database_schema(&db_identity).await?;\nif remote.hash != LOCAL_MODULE_SCHEMA_HASH {\n    anyhow::bail!(\"bindings out of date: regenerate with `spacetime generate`\");\n}","typeGuard":null,"tryCatchPattern":"Decoding happens inside the bindings and panics rather than returning Result. Isolate row decoding in std::panic::catch_unwind at your message-pump boundary, log the module schema hash on failure, and run a regenerate-and-restart recovery path.","preventionTips":["Generate bindings as a build step pinned to the module commit you deploy","Treat a schema hash mismatch as a hard error before subscribing","Never hand-slice BSATN buffers; use the provided readers"],"tags":["rust","bsatn","decode","panic","schema-mismatch","subscriptions","bindings"],"backgroundTag":"schema-decode-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"}