clockworklabs/SpacetimeDB · error · anyhow::Error

Project path does not exist

Error message

Project path does not exist: {}

What it means

Early validation in `spacetime publish`: after resolving auth and the database name/parent, the CLI checks that the project directory to build from actually exists on disk and bails with 'Project path does not exist: <path>' before attempting any build or upload. The path comes from the publish command's project-path argument (or its config resolution), and the check runs only when a path was supplied.

Solutions

  1. Verify and fix the path: `ls <path>` from the same cwd you invoke publish from
  2. Use an absolute path in CI scripts to remove cwd dependence
  3. If the project truly moved, update --project-path or the spacetime.json entry that supplies it

Example fix

# before (run from repo root, wrong relative path)
spacetime publish --project-path server-module
# after
spacetime publish --project-path ./crates/server-module   # verified with ls
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
proj="${1:?usage: publish.sh <project-dir>}"
proj="${proj%/}"   # drop trailing slash/whitespace sources of mismatch
[ -d "$proj" ] || { echo "project dir not found: $proj (from $(pwd))" >&2; exit 2; }
spacetime publish --project-path "$proj"

Prevention

When it happens

Trigger: Running `spacetime publish --project-path <dir>` (or a spacetime.json/config that resolves to one) where <dir> does not exist — wrong relative path judged against the cwd, a deleted/moved directory, or a typo. Publishing with --bin-path/--js-path (wasm/js file) skips this check.

Common situations: Running publish from a different cwd than where the path was written for (relative '../server' resolves differently); directory renamed after a refactor while scripts kept the old path; CI checkouts that skip the server module; trailing whitespace or quotes around the path in shell scripts.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/1e5ff860676ab6fc. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/subcommands/publish.rs:663

        let dotnet_version = if command_config.is_from_cli("dotnet_version") {
            command_config.get_one::<u8>("dotnet_version")?
        } else {
            let dotnet_version = command_config.get_one::<String>("dotnet_version")?;
            parse_optional_dotnet_version(dotnet_version.as_deref())?
        };

        // If the user didn't specify an identity and we didn't specify an anonymous identity, then
        // we want to use the default identity
        // TODO(jdetter): We should maybe have some sort of user prompt here for them to be able to
        //  easily create a new identity with an email
        let auth_header = get_auth_header(config, anon_identity, server, !yes.skip_login).await?;

        let (name_or_identity, parent) = validate_name_and_parent(name_or_identity, parent)?;

        if let Some(path_to_project) = path_to_project.as_ref()
            && !path_to_project.exists()
        {
            return Err(anyhow::anyhow!(
                "Project path does not exist: {}",
                path_to_project.display()
            ));
        }

        // Decide program file path and read program.
        // Optionally build the program.
        let (path_to_program, host_type) = if let Some(path) = wasm_file {
            println!("(WASM) Skipping build. Instead we are publishing {}", path.display());
            (path.clone(), "Wasm")
        } else if let Some(path) = js_file {
            println!("(JS) Skipping build. Instead we are publishing {}", path.display());
            (path.clone(), "Js")
        } else {
            build::exec_with_argstring(
                path_to_project
                    .as_ref()
                    .expect("path_to_project must exist when publishing from source"),

View on GitHub (pinned to eddf9f5014)