clockworklabs/SpacetimeDB · error
Fatal Error: path {} does not exist.
Error message
Fatal Error: path {} does not exist. What it means
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.
Source
Thrown at crates/cli/src/subcommands/build.rs:89
pub fn run_build(
module_path: PathBuf,
lint_dir: Option<PathBuf>,
build_debug: bool,
features: Option<OsString>,
native_aot: bool,
dotnet_version: Option<u8>,
) -> Result<(PathBuf, &'static str), anyhow::Error> {
// Create the project path, or make sure the target project path is empty.
if module_path.exists() {
if !module_path.is_dir() {
return Err(anyhow::anyhow!(
"Fatal Error: path {} exists but is not a directory.",
module_path.display()
));
}
} else {
return Err(anyhow::anyhow!(
"Fatal Error: path {} does not exist.",
module_path.display()
));
}
let result = crate::tasks::build(
&module_path,
lint_dir.as_deref(),
build_debug,
features.as_ref(),
native_aot,
dotnet_version,
)?;
// For TypeScript modules, extract the schema from the bundle and emit
// advisory warnings (e.g. HTTP handlers in mounted sub-modules are unsupported).
// If the standalone binary is unavailable or extraction fails, skip silently.
if result.1 == "Js"View on GitHub (pinned to 524b4487d9)
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
Example fix
# before spacetime build --module-path ./modual # after spacetime build --module-path ./module
Defensive patterns
Strategy: validation
Validate before calling
# Verify the module path exists (and resolve it absolutely) before building
MODULE_PATH="$(realpath -e "$MODULE_PATH" 2>/dev/null)" || { echo "module path not found" >&2; exit 1; }
spacetime build --module-path "$MODULE_PATH" Type guard
fn ensure_exists(p: &Path) -> anyhow::Result<&Path> {
if p.exists() { Ok(p) } else { anyhow::bail!("module path does not exist: {}", p.display()) }
} Try / catch
match run_build(module_path, lint_dir, debug, features, aot, ver).await {
Ok(v) => v,
Err(e) if e.to_string().contains("does not exist") => {
Err(e.context("check the path / working directory, then retry"))
}
Err(e) => Err(e),
} Prevention
- 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
When it happens
Trigger: `spacetime build --module-path <path>` where <path> doesn't exist: typo, wrong case, or a relative path interpreted from an unexpected cwd.
Common situations: 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.
Related errors
- Fatal Error: path {} exists but is not a directory.
- Could not find a SpacetimeDB module in spacetimedb/ or the c
- Module bindings path {} exists but is not a directory.
- Module directory does not exist: '{}'. Check your --module-p
- Module bindings path must be a relative path
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/16accc0362d17f0a.
Report an issue: GitHub.