{"record":{"id":"98475ee6a6e97780","repo":"clockworklabs/SpacetimeDB","slug":"unknown-constraint-type","errorCode":null,"errorMessage":"Unknown constraint type","messagePattern":"Unknown constraint type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/schema/src/def/validate/v9.rs","lineNumber":1332,"sourceCode":"    {\n        let RawConstraintDefV9 { name, data } = constraint;\n\n        if let RawConstraintDataV9::Unique(RawUniqueConstraintDataV9 { columns }) = data {\n            let name = make_name(name, &columns);\n\n            let columns: Result<ColList> = self.validate_col_ids(&name, columns);\n            let name = self.add_to_global_namespace(name);\n\n            let (name, columns) = (name, columns).combine_errors()?;\n            let columns: ColSet = columns.into();\n            Ok(ConstraintDef {\n                // Stamped by `ModuleDef::apply_namespace` once the module tree is assembled.\n                namespace: NamespacePath::root(),\n                name,\n                data: ConstraintData::Unique(UniqueConstraintData { columns }),\n            })\n        } else {\n            unimplemented!(\"Unknown constraint type\")\n        }\n    }\n\n    /// Validate a schedule definition.\n    pub(crate) fn validate_schedule_def(\n        &mut self,\n        schedule: RawScheduleDefV9,\n        primary_key: Option<ColId>,\n    ) -> Result<ScheduleDef> {\n        let RawScheduleDefV9 {\n            // Despite the field name, a `RawScheduleDefV9` may refer to either a reducer or a function.\n            reducer_name: function_name,\n            scheduled_at_column,\n            name,\n        } = schedule;\n\n        let name = name.unwrap_or_else(|| generate_schedule_name(&self.table_ident.clone()));\n","sourceCodeStart":1314,"sourceCodeEnd":1350,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/schema/src/def/validate/v9.rs#L1314-L1350","documentation":"While validating a v9 module definition, the constraint validator only knows RawConstraintDataV9::Unique (crates/schema/src/def/validate/v9.rs:1332); every other variant of the (extensible) constraint data enum hits unimplemented!(). In practice this fires when the module's ABI contains a constraint kind this host build predates.","triggerScenarios":"Publishing a module built with a newer spacetimedb SDK that emits a constraint kind other than unique (only 'unique' constraints are defined today) to an older host; hand-crafted ABI blobs with unknown constraint tags.","commonSituations":"SDK/host version skew after upgrading the Rust SDK but not the server; CI publishing with a pre-release toolchain against an older standalone host (spacetime start) or hosted cluster.","solutions":["Match versions: pin the module SDK to the version matching your host (compare with spacetime version / spacetimedb crate version)","Update the SpacetimeDB host (local spacetime start or the hosted cluster) to at least the SDK's version and republish","Until matched, declare only #[unique] constraints, which every current host validates"],"exampleFix":"# before (Cargo.toml)\nspacetimedb = \"2.0\" # newer than host\n\n# after\nspacetimedb = \"=1.x\" # exact version supported by the running host","handlingStrategy":"validation","validationCode":"# Verify host and SDK agree before publishing:\nspacetime version            # shows CLI/host version\ngrep -m1 'spacetimedb' Cargo.toml  # module SDK version\n# Rule of thumb: SDK major.minor must be <= host major.minor","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the spacetimedb SDK to the exact version of your host/cluster","Re-publish after every host upgrade to surface ABI gaps early","Restrict schema constraints to #[unique] until newer kinds are supported by your host"],"tags":["schema","validation","constraint","abi","version-skew","unimplemented","spacetimedb"],"backgroundTag":"abi-version-mismatch","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}