clockworklabs/SpacetimeDB · error · anyhow::Error
Template definition missing
Error message
Template definition missing
What it means
Builtin-template scaffolding expects a resolved template definition (parsed from the embedded catalog) alongside the builtin template type. Reaching `init_builtin` without one means an internal invariant broke — the chosen path didn't attach a definition. This is a CLI defect or catalog/build mismatch, not a user-input error you can fix by changing flags.
Source
Thrown at crates/cli/src/subcommands/init.rs:1378
// Install AI assistant rules for multiple editors/tools
install_ai_rules(config, project_path)?;
println!("{}", "Project initialized successfully!".green());
Ok(())
}
fn init_builtin(
config: &TemplateConfig,
project_path: &Path,
is_server_only: bool,
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) => {View on GitHub (pinned to 524b4487d9)
Solutions
- Update the SpacetimeDB CLI to the latest stable release
- Work around it: scaffold with `--lang` (empty project) or `--template owner/repo` (git clone)
- If it persists on the latest release, report it with the template id and CLI version
Example fix
# before — builtin template path loses its definition spacetime init my-app --non-interactive --template rust-quickstart # after — update and use the language path (no builtin template needed) spacetime update spacetime init my-app --non-interactive --project-name my-app --lang rust
Defensive patterns
Strategy: fallback
Prevention
- Keep the SpacetimeDB CLI on a stable release — this is an internal invariant break, not an input error
- Pin a known-good CLI version in CI so a bad nightly can't break scaffolding
- Keep a fallback scaffold path (--lang or --template owner/repo) in your project bootstrap docs
When it happens
Trigger: Selecting a builtin template whose catalog entry failed to resolve into a TemplateDefinition; a CLI build where the template-type routing and catalog parsing disagree; catalog format changes between CLI builds.
Common situations: Pre-release or nightly CLI versions; templates newly added to an embedded catalog your build partially understands.
Related errors
- Client template not found: {}
- Server template not found: {}
- Unknown client language: {}
- Either --template or --lang must be provided in non-interact
- No templates found for selected language
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/70279a831a69bf12.
Report an issue: GitHub.