clockworklabs/SpacetimeDB · error · anyhow::Error

No templates found for selected language

Error message

No templates found for selected language

What it means

During interactive init, the language/template picker is built from the template catalog embedded in the CLI binary, grouped by language. After you select a language, the template indices for it are looked up; a miss means the embedded catalog is internally inconsistent (language keys and per-language groupings out of sync) — a packaging defect in that CLI build, not something your input caused.

Source

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

        })
        .collect();
    lang_items.push("Clone from GitHub (owner/repo or git URL)".to_string());
    lang_items.push("None".to_string());

    let github_clone_index = lang_keys.len();
    let none_index = lang_keys.len() + 1;
    loop {
        let client_selection = FuzzySelect::with_theme(&theme)
            .with_prompt("Select a language (type to filter)")
            .items(&lang_items)
            .default(0)
            .interact()?;

        if client_selection < lang_keys.len() {
            let selected_lang = &lang_keys[client_selection];
            let template_indices = templates_by_lang
                .get(selected_lang)
                .ok_or_else(|| anyhow::anyhow!("No templates found for selected language"))?;

            let template = if template_indices.len() > 1 {
                let template_items: Vec<String> = template_indices
                    .iter()
                    .map(|&idx| {
                        let template = &templates[idx];
                        format!("{} - {}", template.id, template.description)
                    })
                    .collect();

                let pair_prompt = format!("Templates available for {selected_lang} (type to filter, Esc to go back)");
                let template_selection = FuzzySelect::with_theme(&theme)
                    .with_prompt(&pair_prompt)
                    .items(&template_items)
                    .default(0)
                    .interact_opt()?;

                let Some(template_selection) = template_selection else {

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Update the SpacetimeDB CLI to a stable release
  2. Bypass the picker: `spacetime init --non-interactive --lang <lang>` or `--template <id>`
  3. Run `spacetime init --template=` (empty value) to print the template list and pick a concrete id
  4. If it persists on the latest release, report it with the CLI version

Example fix

# before — interactive picker hits an inconsistent catalog
spacetime init

# after — non-interactive, no catalog grouping involved
spacetime init --non-interactive --project-name my-app --lang rust
Defensive patterns

Strategy: fallback

Validate before calling

# Verify the embedded catalog has content before entering the interactive picker:
spacetime init --template= | grep -q '^  ' \
  || { echo "template catalog looks empty — update the CLI" >&2; exit 2; }

Prevention

When it happens

Trigger: Interactive `spacetime init` on a CLI build whose embedded templates.json lists languages with empty/mismatched template groups; pre-release or hand-built CLI binaries.

Common situations: Version skew inside a single CLI build; templates removed from the catalog while language keys remained; custom or patched CLI builds.

Related errors


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