{"record":{"id":"359f930b8a292d66","repo":"clockworklabs/SpacetimeDB","slug":"source-name-should-be-provided-in-v10-accessor-na","errorCode":null,"errorMessage":"source_name should be provided in V10, accessor_names inside module","messagePattern":"source_name should be provided in V10, accessor_names inside module","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/schema/src/def/validate/v9.rs","lineNumber":1234,"sourceCode":"            namespace: NamespacePath::root(),\n            name: name.clone(),\n            accessor_name: codegen_name,\n            source_name: name,\n            algorithm,\n        })\n    }\n\n    /// Validates an index definition for V10 and later versions\n    pub(crate) fn validate_index_def_v10(&mut self, index: RawIndexDefV10) -> Result<IndexDef> {\n        let RawIndexDefV10 {\n            source_name,\n            algorithm: algorithm_raw,\n            accessor_name,\n        } = index;\n\n        //source_name will be used as alias, hence we need to add it to the global namespace as\n        //well.\n        let source_name = source_name.expect(\"source_name should be provided in V10, accessor_names inside module\");\n        let source_name = self.add_to_global_namespace(source_name.clone())?;\n\n        let name = if self.module_validator.explicit_names.indexes.get(&source_name).is_some() {\n            self.module_validator.resolve_index_ident(source_name.clone())?\n        } else {\n            identifier(generate_index_name(\n                &self.table_ident,\n                self.product_type,\n                &algorithm_raw,\n            ))?\n        };\n\n        let name = if *name.as_raw() != source_name {\n            self.add_to_global_namespace(name.as_raw().clone())?\n        } else {\n            name.as_raw().clone()\n        };\n","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/schema/src/def/validate/v9.rs#L1216-L1252","documentation":"In schema-def validation for V10+, `RawIndexDefV10.source_name` is an Option, but the v10 format requires it, so `validate_index_def_v10` unwraps with this expect. The field is populated by the spacetimedb macro codegen; hitting the panic means the RawIndexDefV10 was hand-constructed without source_name, or produced by mismatched macro/schema crate versions.","triggerScenarios":"Manually building `RawIndexDefV10 { source_name: None, .. }` and validating it; or mixing an older bindings-macro crate that emits V10 defs without source_name with a newer schema crate that requires it.","commonSituations":"Custom build pipelines that synthesize index defs; dependency version skew among spacetimedb crates (Cargo tree -p spacetimedb-bindings-macro / spacetimedb-schema); forked codegen missing the field.","solutions":["Set source_name (Some(identifier)) when constructing RawIndexDefV10 manually — it becomes the index's alias in the global namespace.","Align spacetimedb crate versions so macro codegen and schema validator agree (check cargo tree for mixed versions).","Prefer deriving index defs via #[spacetimedb::table(index(...))] instead of hand-building raw defs."],"exampleFix":"// before\nlet def = RawIndexDefV10 { source_name: None, algorithm, accessor_name };\n\n// after: V10 defs require the source name\nlet def = RawIndexDefV10 { source_name: Some(identifier(\"players_name_idx\")?), algorithm, accessor_name };","handlingStrategy":"validation","validationCode":"let def = RawIndexDefV10 { source_name: Some(index_name.clone()), algorithm, accessor_name };\nassert!(def.source_name.is_some(), \"V10 index defs require source_name\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin consistent versions of all spacetimedb crates in the workspace.","Let macros generate index defs; don't hand-assemble raw def structs.","Add a smoke test validating a generated module def after dependency upgrades."],"tags":["rust","spacetimedb","schema","index","version-mismatch"],"backgroundTag":"schema-version-mismatch","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}