{"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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":262,"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":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/3653d2ed498fddbd83b7062aa6bf8970e18635ec/crates/cli/src/subcommands/dev.rs#L244-L280","documentation":"During `spacetime dev`, if no module path can be found the CLI interactively offers to prompt for one. That prompt needs a base directory to resolve relative paths against, taken from loaded_config.config_dir (the directory of the discovered spacetime.json). When loaded_config is None — no project config file was found — there is no base directory, so the command errors with 'Missing loaded config directory' after you accept the prompt.","triggerScenarios":"Running `spacetime dev` in a directory tree with no spacetime.json, without --module-path, and answering 'Yes' to 'Would you like to provide --module-path now?'. The preceding guard already bails if you answer No; this branch bails because the interactive prompt cannot resolve relative module paths without a config dir.","commonSituations":"First-run of dev in a brand-new/empty folder before `spacetime init`; running dev from the wrong terminal tab/cwd; a spacetime.json that was renamed or is one directory above the cwd outside the search scope; CI/non-TTY environments where the config discovery silently found nothing.","solutions":["Pass the module path explicitly so the prompt never runs: `spacetime dev --module-path ./spacetimedb`","Create or move a spacetime.json in the project directory (or a parent of it) so config discovery succeeds and config_dir exists","Run `spacetime init` first to scaffold a project with a config file, then re-run dev"],"exampleFix":"# before (no spacetime.json anywhere up the tree)\nspacetime dev\n# -> prompt -> Yes -> 'Missing loaded config directory'\n\n# after\nspacetime dev --module-path ./server","handlingStrategy":"validation","validationCode":"# Before dev, ensure a config exists or pass the module path explicitly:\nif [ ! -f spacetime.json ]; then\n  spacetime dev --module-path ./spacetimedb \"$@\"\nelse\n  spacetime dev \"$@\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --module-path when running dev outside a configured project","Run `spacetime init` first so the project has spacetime.json and a config_dir","Avoid interactive prompts in non-TTY environments (CI) — they cannot recover without a config"],"tags":["cli","dev","module-path","config","interactive-prompt"],"backgroundTag":"missing-project-config","analyzedSha":"3653d2ed498fddbd83b7062aa6bf8970e18635ec","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}