clockworklabs/SpacetimeDB · error · anyhow::Error

Server template not found: {}

Error message

Server template not found: {}

What it means

The server half of a builtin template is copied from file sets embedded in the CLI binary, keyed by the catalog's `server_source` name. If the embedded assets contain no entry for that key — catalog and embedded files out of sync within the build — init aborts after the client half may already have been copied. Same failure family as the client variant, one phase later.

Source

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

                update_cargo_toml_name(project_path, &config.project_name)?;
            }
            Some(ClientLanguage::Csharp) => {
                update_csproj_client_to_nuget(project_path)?;
            }
            None => {}
        }
    }

    println!(
        "Setting up server ({})...",
        config.server_lang.map(|l| l.as_str()).unwrap_or("none")
    );
    let server_dir = project_path.join("spacetimedb");
    let server_source = &template_def.server_source;
    if let Some(files) = template_files.get(server_source.as_str()) {
        copy_embedded_files(files, &server_dir)?;
    } else {
        anyhow::bail!("Server template not found: {}", server_source);
    }

    // Update server name
    match config.server_lang {
        Some(ServerLanguage::TypeScript) => {
            update_package_json(&server_dir, &config.project_name)?;
        }
        Some(ServerLanguage::Rust) => {
            update_cargo_toml_name(&server_dir, &config.project_name)?;
        }
        Some(ServerLanguage::Csharp) => {
            update_csproj_server_to_nuget(&server_dir)?;
        }
        Some(ServerLanguage::Cpp) => {
            // No name update needed for C++ at the moment
        }
        None => {}
    }

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 the server with `--lang`
  3. If re-running after this error, clean the partially scaffolded project directory first
  4. If it persists on the latest release, report it with the template id and CLI version

Example fix

# before — embedded server assets missing for this template
spacetime init my-app --non-interactive --template fullstart-csharp

# after — update CLI, clean partial output, fall back to --lang
spacetime update
rm -rf my-app
spacetime init my-app --non-interactive --project-name my-app --lang csharp
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: A CLI build whose templates.json advertises a server_source with no matching embedded file set; server template directories renamed without updating the catalog.

Common situations: Pre-release or custom CLI builds; templates added to the catalog after the embedded assets were frozen; partial cleanup after this error leaves a copied client half behind.

Related errors


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