clockworklabs/SpacetimeDB · error

Missing loaded config directory

Error message

Missing loaded config directory

What it means

Internal invariant error in `spacetime dev`: the interactive module-path prompt needs the directory of the loaded `spacetime.json` (to resolve relative answers), but `loaded_config` is `None` at that point. This should not be reachable in normal operation — the prompt only appears when config files were discovered, which normally implies a loaded config. Hitting it indicates a CLI bug or an inconsistent state between config discovery and config loading (e.g. `--project-path` pointing at a directory whose config failed to load).

Source

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

                .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)
                        };
                        if resolved.exists() {
                            Ok(())
                        } else {
                            Err(format!(
                                "Path does not exist: {} (resolved to {})",

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Ensure `spacetime.json` in the target project directory is valid JSON and readable
  2. Run `spacetime dev` from the project root without `--project-path` overrides
  3. Pre-create the module directory (`./spacetimedb`) so the interactive path is skipped entirely
  4. If it persists, report it as a CLI bug with your `spacetime --version` and directory layout
Defensive patterns

Strategy: try-catch

Validate before calling

# Confirm the config loads cleanly before dev
jq empty spacetime.json && spacetime dev

Try / catch

// Treat as non-retryable config/environment failure: surface the message and fix the project layout; do not retry the same invocation unchanged.

Prevention

When it happens

Trigger: A code path where config files are found (triggering the prompt) while `loaded_config` stays `None`, such as a load failure swallowed earlier, a `--project-path` pointing at a directory without a loadable `spacetime.json`, or a CLI version regression.

Common situations: Rare; typically after a CLI upgrade changed config discovery rules, or when the project path contains an unreadable/malformed `spacetime.json` that discovery still counts.

Related errors


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