{"record":{"id":"42f45825fe35bd2b","repo":"clockworklabs/SpacetimeDB","slug":"client-template-not-found","errorCode":null,"errorMessage":"Client template not found: {}","messagePattern":"Client template not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/init.rs","lineNumber":1395,"sourceCode":"    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) => {\n                update_package_json(project_path, &config.project_name)?;\n                write_typescript_client_env_file(project_path, &config.project_name, config.use_local)?;\n                println!(\n                    \"{}\",\n                    \"Note: Run 'npm install' in the project directory to install dependencies\".yellow()\n                );\n            }\n            Some(ClientLanguage::Rust) => {\n                update_cargo_toml_name(project_path, &config.project_name)?;\n            }\n            Some(ClientLanguage::Csharp) => {\n                update_csproj_client_to_nuget(project_path)?;\n            }","sourceCodeStart":1377,"sourceCodeEnd":1413,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/cli/src/subcommands/init.rs#L1377-L1413","documentation":"During project generation, the selected template definition names a client source directory key that is absent from the templates compiled into the CLI binary (embedded at build time via include_str!). This is an internal mapping inconsistency between TemplateDef::client_source and the embedded::get_template_files() map, not something in your code.","triggerScenarios":"A custom or newly added template definition referencing a client_source key that was never embedded; CLI built from a fork where templates/ and template defs drifted; an older CLI binary receiving a newer template name.","commonSituations":"Using a custom-built or forked SpacetimeDB CLI; template refactor landed for template defs but not the embedded file map; version skew between docs and installed binary.","solutions":["Retry with a stock built-in template (e.g. `--template quickstart` or `--lang rust`) to confirm the binary is healthy","Update/reinstall the official CLI release so embedded templates and defs match","If building from source, verify every client_source key exists under templates/ and rebuild","Report the failing template name as a bug if it reproduces on an official release"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin a known-good CLI version in CI so embedded templates and defs never drift","Smoke-test custom templates with a throwaway init after every CLI rebuild"],"tags":["spacetime-init","template","embedded-assets","cli"],"backgroundTag":"template-not-found","analyzedSha":"fdd647dfac506d0967cc4492e9fce380706c94cb","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}