clockworklabs/SpacetimeDB · error
Module bindings path must be a relative path
Error message
Module bindings path must be a relative path
What it means
`spacetime dev` requires `--module-bindings-path` (and any bindings path from `spacetime.json`) to be relative because it is joined onto the resolved project directory (`project_dir.join(module_bindings_path)`). An absolute path is rejected so the CLI can keep all generated bindings under the project root and compute stable relative paths.
Source
Thrown at crates/cli/src/subcommands/dev.rs:176
// If you don't specify a server, we default to your default server
// If you don't have one of those, we default to "maincloud"
let server_from_cli = args.get_one::<String>("server").map(|s| s.as_str());
let default_server_name = config.default_server_name().map(|s| s.to_string());
let mut resolved_server = server_from_cli
.or(default_server_name.as_deref())
.ok_or_else(|| anyhow::anyhow!("Server not specified and no default server configured."))?;
let cwd = std::env::current_dir()?;
let mut project_dir = if project_path.is_absolute() {
project_path.clone()
} else {
cwd.join(project_path)
};
if module_bindings_path.is_absolute() {
anyhow::bail!("Module bindings path must be a relative path");
}
let mut module_bindings_dir = project_dir.join(module_bindings_path);
let mut spacetimedb_dir = match module_path_from_cli {
Some(path) => {
if path.is_absolute() {
path.clone()
} else {
std::env::current_dir()?.join(path)
}
}
None => project_dir.join("spacetimedb"),
};
let no_config = args.get_flag("no_config");
let skip_publish = args.get_flag("skip_publish");
let skip_generate = args.get_flag("skip_generate");
let dotnet_version = args.get_one::<u8>("dotnet_version").map(u8::to_string);View on GitHub (pinned to 524b4487d9)
Solutions
- Change the path to be relative to the project root: `--module-bindings-path generated`
- If the config file has an absolute bindings path, edit `spacetime.json` to a relative one
- Move the desired output directory under the project directory if it currently lives outside it
Example fix
# before spacetime dev --module-bindings-path /home/me/app/client/src/generated # after spacetime dev --module-bindings-path client/src/generated
Defensive patterns
Strategy: validation
Validate before calling
# Reject absolute bindings paths before invoking dev BP="client/src/generated" case "$BP" in /*|?:\\*) echo "must be relative"; exit 1;; esac spacetime dev --module-bindings-path "$BP"
Prevention
- Treat all paths in spacetime.json as project-relative by convention
- Never let `$PWD` interpolation produce the bindings path
When it happens
Trigger: Running `spacetime dev --module-bindings-path /home/me/project/generated`, or a `spacetime.json` whose bindings path is absolute (leading `/` on Unix or drive letter on Windows).
Common situations: Autocomplete shells inserting absolute paths; copying a config from a teammate or tutorial with a machine-specific absolute path; scripts that compute `$PWD/generated` before calling the CLI.
Related errors
- No such saved server configuration: {server} Add a new serve
- No default server configuration. Set an existing server as t
- Server nickname {} already in use: {}://{}
- Server host name is ambiguous with existing server nickname:
- Could not find a SpacetimeDB module in spacetimedb/ or the c
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/5963c8c9462f711b.
Report an issue: GitHub.