{"record":{"id":"70279a831a69bf12","repo":"clockworklabs/SpacetimeDB","slug":"template-definition-missing","errorCode":null,"errorMessage":"Template definition missing","messagePattern":"Template definition missing","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/init.rs","lineNumber":1378,"sourceCode":"\n    // Install AI assistant rules for multiple editors/tools\n    install_ai_rules(config, project_path)?;\n\n    println!(\"{}\", \"Project initialized successfully!\".green());\n\n    Ok(())\n}\n\nfn init_builtin(\n    config: &TemplateConfig,\n    project_path: &Path,\n    is_server_only: bool,\n    dotnet_major: Option<u8>,\n) -> anyhow::Result<()> {\n    let template_def = config\n        .template_def\n        .as_ref()\n        .ok_or_else(|| anyhow::anyhow!(\"Template definition missing\"))?;\n\n    let template_files = embedded::get_template_files();\n\n    if !is_server_only {\n        println!(\n            \"Setting up client ({})...\",\n            config.client_lang.map(|l| l.as_str()).unwrap_or(\"none\")\n        );\n        let client_source = &template_def.client_source;\n        if let Some(files) = template_files.get(client_source.as_str()) {\n            copy_embedded_files(files, project_path)?;\n        } else {\n            anyhow::bail!(\"Client template not found: {}\", client_source);\n        }\n\n        // Update client name\n        match config.client_lang {\n            Some(ClientLanguage::TypeScript) => {","sourceCodeStart":1360,"sourceCodeEnd":1396,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/init.rs#L1360-L1396","documentation":"Builtin-template scaffolding expects a resolved template definition (parsed from the embedded catalog) alongside the builtin template type. Reaching `init_builtin` without one means an internal invariant broke — the chosen path didn't attach a definition. This is a CLI defect or catalog/build mismatch, not a user-input error you can fix by changing flags.","triggerScenarios":"Selecting a builtin template whose catalog entry failed to resolve into a TemplateDefinition; a CLI build where the template-type routing and catalog parsing disagree; catalog format changes between CLI builds.","commonSituations":"Pre-release or nightly CLI versions; templates newly added to an embedded catalog your build partially understands.","solutions":["Update the SpacetimeDB CLI to the latest stable release","Work around it: scaffold with `--lang` (empty project) or `--template owner/repo` (git clone)","If it persists on the latest release, report it with the template id and CLI version"],"exampleFix":"# before — builtin template path loses its definition\nspacetime init my-app --non-interactive --template rust-quickstart\n\n# after — update and use the language path (no builtin template needed)\nspacetime update\nspacetime init my-app --non-interactive --project-name my-app --lang rust","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the SpacetimeDB CLI on a stable release — this is an internal invariant break, not an input error","Pin a known-good CLI version in CI so a bad nightly can't break scaffolding","Keep a fallback scaffold path (--lang or --template owner/repo) in your project bootstrap docs"],"tags":["init","template","internal-error","version-skew"],"backgroundTag":"missing-template-definition","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}