clockworklabs/SpacetimeDB · error · anyhow::Error
PROJECT_NAME is required in non-interactive mode
Error message
PROJECT_NAME is required in non-interactive mode
What it means
init prompts for a project name interactively (defaulting to my-spacetime-app), but with `--non-interactive` (or any scripted context that disables prompting) there is no prompt, so the name must already be provided via `--project-name` or init aborts before doing anything.
Source
Thrown at crates/cli/src/subcommands/init.rs:271
println!("{}", "Continuing with local deployment.".yellow());
Ok(false)
}
}
fn slugify(name: &str) -> String {
name.to_case(Case::Kebab)
}
async fn get_project_name(options: &InitOptions, is_interactive: bool) -> anyhow::Result<String> {
if let Some(name) = &options.project_name {
if is_interactive {
println!("{} {}", "Project name:".bold(), name);
}
return Ok(name.clone());
}
if !is_interactive {
anyhow::bail!("PROJECT_NAME is required in non-interactive mode");
}
let default_project_name = options
.project_name_default
.clone()
.unwrap_or_else(|| "my-spacetime-app".to_string());
let theme = ColorfulTheme::default();
let name = Input::with_theme(&theme)
.with_prompt("Project name")
.default(default_project_name)
.validate_with(|input: &String| -> Result<(), String> {
if input.trim().is_empty() {
return Err("Project name cannot be empty".to_string());
}
Ok(())
})
.interact_text()?View on GitHub (pinned to 524b4487d9)
Solutions
- Pass the name: `spacetime init --non-interactive --project-name my-app --lang rust`
- Or run interactively (omit --non-interactive and keep a TTY) to get the prompt with its default
- In containers, use `docker run -it` / `script -qc` if you actually want prompts
Example fix
# before spacetime init --non-interactive --lang rust # after spacetime init --non-interactive --project-name my-app --lang rust
Defensive patterns
Strategy: validation
Validate before calling
# Require a name whenever prompts are disabled: if [[ "$NON_INTERACTIVE" == "true" && -z "$PROJECT_NAME" ]]; then echo "--project-name is required with --non-interactive" >&2; exit 2 fi spacetime init --non-interactive --project-name "$PROJECT_NAME" --lang rust
Prevention
- Treat --non-interactive as a contract: supply --project-name, --lang or --template up front
- In CI, fail fast on missing variables before invoking the CLI so errors stay actionable
When it happens
Trigger: `spacetime init --non-interactive --lang rust` with no `--project-name`; CI jobs, Dockerfiles, and make targets that call init without a name; piping stdin so the interactive prompt cannot appear.
Common situations: CI pipelines and container builds; automation scripts written against interactive behavior; forgetting that the flag disabling prompts also removes the name default.
Related errors
- Either --template or --lang must be provided in non-interact
- Unknown server language: {}
- Unknown client language: {}
- --dotnet-version is only supported for C# projects (--lang c
- Path {} exists but is not a directory. A new SpacetimeDB pro
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/9d7926ccf36bf710.
Report an issue: GitHub.