{"record":{"id":"16accc0362d17f0a","repo":"clockworklabs/SpacetimeDB","slug":"fatal-error-path-does-not-exist","errorCode":null,"errorMessage":"Fatal Error: path {} does not exist.","messagePattern":"Fatal Error: path (.+?) does not exist\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/build.rs","lineNumber":89,"sourceCode":"\npub fn run_build(\n    module_path: PathBuf,\n    lint_dir: Option<PathBuf>,\n    build_debug: bool,\n    features: Option<OsString>,\n    native_aot: bool,\n    dotnet_version: Option<u8>,\n) -> Result<(PathBuf, &'static str), anyhow::Error> {\n    // Create the project path, or make sure the target project path is empty.\n    if module_path.exists() {\n        if !module_path.is_dir() {\n            return Err(anyhow::anyhow!(\n                \"Fatal Error: path {} exists but is not a directory.\",\n                module_path.display()\n            ));\n        }\n    } else {\n        return Err(anyhow::anyhow!(\n            \"Fatal Error: path {} does not exist.\",\n            module_path.display()\n        ));\n    }\n\n    let result = crate::tasks::build(\n        &module_path,\n        lint_dir.as_deref(),\n        build_debug,\n        features.as_ref(),\n        native_aot,\n        dotnet_version,\n    )?;\n\n    // For TypeScript modules, extract the schema from the bundle and emit\n    // advisory warnings (e.g. HTTP handlers in mounted sub-modules are unsupported).\n    // If the standalone binary is unavailable or extraction fails, skip silently.\n    if result.1 == \"Js\"","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/build.rs#L71-L107","documentation":"The companion guard to 112 in run_build: module_path does not exist on disk at all. Unlike 111 (no path supplied and auto-discovery failed), here a path was supplied or resolved but nothing lives there — mistyped, relative to the wrong working directory, or the project moved/renamed.","triggerScenarios":"`spacetime build --module-path <path>` where <path> doesn't exist: typo, wrong case, or a relative path interpreted from an unexpected cwd.","commonSituations":"Relative paths run from a different working directory than assumed (CI steps, cron, Makefile targets); project directory renamed after docs/scripts were written; mojibake or trailing whitespace in the path.","solutions":["Verify the path: `ls <path>` — then correct the typo or use an absolute path","cd to the module directory and run `spacetime build` without --module-path to use discovery","Update scripts that hard-code paths after moving/renaming the project"],"exampleFix":"# before\nspacetime build --module-path ./modual\n\n# after\nspacetime build --module-path ./module","handlingStrategy":"validation","validationCode":"# Verify the module path exists (and resolve it absolutely) before building\nMODULE_PATH=\"$(realpath -e \"$MODULE_PATH\" 2>/dev/null)\" || { echo \"module path not found\" >&2; exit 1; }\nspacetime build --module-path \"$MODULE_PATH\"","typeGuard":"fn ensure_exists(p: &Path) -> anyhow::Result<&Path> {\n    if p.exists() { Ok(p) } else { anyhow::bail!(\"module path does not exist: {}\", p.display()) }\n}","tryCatchPattern":"match run_build(module_path, lint_dir, debug, features, aot, ver).await {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"does not exist\") => {\n        Err(e.context(\"check the path / working directory, then retry\"))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Use absolute module paths in CI and Makefiles so the working directory can't change the meaning","Run `realpath -e` (or equivalent) on paths coming from config or env before passing them on"],"tags":["spacetimedb","cli","build","filesystem","path"],"backgroundTag":"path-not-found","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}