clockworklabs/SpacetimeDB · error · anyhow::Error

Client template not found: {}

Error message

Client template not found: {}

What it means

Builtin template file sets are embedded in the CLI binary, keyed by the catalog's `client_source` name. When scaffolding the client half of a project, init looks up that key in the embedded files; if the key is absent — the catalog references a source directory this build never embedded — init aborts. It signals version skew between the embedded catalog and the embedded template assets within one CLI build.

Source

Thrown at crates/cli/src/subcommands/init.rs:1391

    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 524b4487d9)

Solutions

  1. Update the SpacetimeDB CLI so the embedded catalog and assets match
  2. Pick a different template or scaffold by `--lang`
  3. Clone the template repo manually (`git clone https://github.com/owner/repo`) and adapt it
  4. If it persists on the latest release, report it with the template id and CLI version

Example fix

# before — embedded client assets missing for this template
spacetime init my-app --non-interactive --template fullstack-ts

# after — update CLI, or fall back to language scaffolding
spacetime update
spacetime init my-app --non-interactive --project-name my-app --lang typescript
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: A CLI build whose templates.json advertises a client_source that has no matching entry in the embedded file sets; templates renamed on one side but not the other; custom/patched builds.

Common situations: Pre-release or mismatched CLI builds; templates added to the catalog after the embedded assets were frozen.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/42f45825fe35bd2b. Report an issue: GitHub.