clockworklabs/SpacetimeDB · error · anyhow::Error
Client template not found
Error message
Client template not found: {} What it means
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.
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
Defensive patterns
Strategy: fallback
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Server template not found
- Invalid repository format. Use 'owner/repo' or full git…
- Cannot create new SpacetimeDB project in non-empty directory
- Cannot specify both --template and --lang. Language is…
- --dotnet-version is only supported for C# projects (--lang…
AI-assisted analysis of clockworklabs/SpacetimeDB@fdd647dfac (2026-08-20).
Data as JSON: /api/errors/42f45825fe35bd2b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/subcommands/init.rs:1395
dotnet_major: Option<u8>,
) -> anyhow::Result<()> {
let template_def = config
.template_def
.as_ref()
.ok_or_else(|| anyhow::anyhow!("Template definition missing"))?;
let template_files = embedded::get_template_files();
if !is_server_only {
println!(
"Setting up client ({})...",
config.client_lang.map(|l| l.as_str()).unwrap_or("none")
);
let client_source = &template_def.client_source;
if let Some(files) = template_files.get(client_source.as_str()) {
copy_embedded_files(files, project_path)?;
} else {
anyhow::bail!("Client template not found: {}", client_source);
}
// Update client name
match config.client_lang {
Some(ClientLanguage::TypeScript) => {
update_package_json(project_path, &config.project_name)?;
write_typescript_client_env_file(project_path, &config.project_name, config.use_local)?;
println!(
"{}",
"Note: Run 'npm install' in the project directory to install dependencies".yellow()
);
}
Some(ClientLanguage::Rust) => {
update_cargo_toml_name(project_path, &config.project_name)?;
}
Some(ClientLanguage::Csharp) => {
update_csproj_client_to_nuget(project_path)?;
}View on GitHub (pinned to fdd647dfac)