clockworklabs/SpacetimeDB · error · anyhow::Error

Cannot continue without a module path.

Error message

Cannot continue without a module path.

What it means

During `spacetime dev`, when no module path can be determined (no --module-path flag, no module-path in config, and no ./spacetimedb directory), the CLI interactively offers to enter one. Declining that prompt aborts the command with this message rather than guessing a location.

Solutions

  1. Re-run and accept the prompt, or pass --module-path explicitly
  2. Create the module directory (`mkdir spacetimedb`) or set module-path in spacetime.json
  3. Run from the project root or pass --project-path so the default ./spacetimedb resolves

Example fix

# before
spacetime dev    # answered 'No' at the --module-path prompt

# after
spacetime dev --module-path ./spacetimedb
Defensive patterns

Strategy: validation

Validate before calling

// verify a module path source exists before starting dev
let has_module = cli_module_path.is_some()
    || config.module_path.is_some()
    || project_dir.join("spacetimedb").exists();
anyhow::ensure!(has_module, "no module path: pass --module-path or create ./spacetimedb");

Prevention

When it happens

Trigger: Running `spacetime dev` in a directory without a spacetimedb/ dir or configured module path and answering 'No' to 'Would you like to provide --module-path now?' (or hitting EOF in a non-interactive shell).

Common situations: Non-interactive terminals where the dialog cannot complete; running from the wrong directory; abandoned first-time setup.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@3653d2ed49 (2026-08-20). Data as JSON: /api/errors/39d2a558b94bf06e. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/subcommands/dev.rs:256

                    lc.loaded_files
                        .iter()
                        .map(|f| strip_verbatim_prefix(f).display().to_string())
                        .collect::<Vec<_>>()
                        .join(", ")
                })
                .unwrap_or_else(|| "spacetime.json".to_string());
            println!("{} {}", "Found config files:".yellow().bold(), files.dimmed());
            println!(
                "{}",
                "Could not determine module path because no `module-path` was found and `./spacetimedb` does not exist."
                    .yellow()
            );
            let should_provide = Confirm::new()
                .with_prompt("Would you like to provide --module-path now?")
                .default(true)
                .interact()?;
            if !should_provide {
                anyhow::bail!("Cannot continue without a module path.");
            }

            let config_dir = loaded_config
                .as_ref()
                .map(|lc| lc.config_dir.clone())
                .ok_or_else(|| anyhow::anyhow!("Missing loaded config directory"))?;

            let provided_module_path: String = Input::with_theme(&ColorfulTheme::default())
                .with_prompt("Module path")
                .default("spacetimedb".to_string())
                .validate_with({
                    let config_dir = config_dir.clone();
                    move |input: &String| -> Result<(), String> {
                        let candidate = PathBuf::from(input);
                        let resolved = if candidate.is_absolute() {
                            candidate
                        } else {
                            config_dir.join(&candidate)

View on GitHub (pinned to 3653d2ed49)