{"record":{"id":"ae9c7d030fd91db1","repo":"clockworklabs/SpacetimeDB","slug":"missing-loaded-config-directory","errorCode":null,"errorMessage":"Missing loaded config directory","messagePattern":"Missing loaded config directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":256,"sourceCode":"                .unwrap_or_else(|| \"spacetime.json\".to_string());\n            println!(\"{} {}\", \"Found config files:\".yellow().bold(), files.dimmed());\n            println!(\n                \"{}\",\n                \"Could not determine module path because no `module-path` was found and `./spacetimedb` does not exist.\"\n                    .yellow()\n            );\n            let should_provide = Confirm::new()\n                .with_prompt(\"Would you like to provide --module-path now?\")\n                .default(true)\n                .interact()?;\n            if !should_provide {\n                anyhow::bail!(\"Cannot continue without a module path.\");\n            }\n\n            let config_dir = loaded_config\n                .as_ref()\n                .map(|lc| lc.config_dir.clone())\n                .ok_or_else(|| anyhow::anyhow!(\"Missing loaded config directory\"))?;\n\n            let provided_module_path: String = Input::with_theme(&ColorfulTheme::default())\n                .with_prompt(\"Module path\")\n                .default(\"spacetimedb\".to_string())\n                .validate_with({\n                    let config_dir = config_dir.clone();\n                    move |input: &String| -> Result<(), String> {\n                        let candidate = PathBuf::from(input);\n                        let resolved = if candidate.is_absolute() {\n                            candidate\n                        } else {\n                            config_dir.join(&candidate)\n                        };\n                        if resolved.exists() {\n                            Ok(())\n                        } else {\n                            Err(format!(\n                                \"Path does not exist: {} (resolved to {})\",","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dev.rs#L238-L274","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure `spacetime.json` in the target project directory is valid JSON and readable","Run `spacetime dev` from the project root without `--project-path` overrides","Pre-create the module directory (`./spacetimedb`) so the interactive path is skipped entirely","If it persists, report it as a CLI bug with your `spacetime --version` and directory layout"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Confirm the config loads cleanly before dev\njq empty spacetime.json && spacetime dev","typeGuard":null,"tryCatchPattern":"// Treat as non-retryable config/environment failure: surface the message and fix the project layout; do not retry the same invocation unchanged.","preventionTips":["Keep spacetime.json valid and readable","Run dev from the project root without --project-path overrides"],"tags":["cli","internal","invariant","spacetimedb"],"backgroundTag":"internal-invariant-violation","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}