{"record":{"id":"5963c8c9462f711b","repo":"clockworklabs/SpacetimeDB","slug":"module-bindings-path-must-be-a-relative-path","errorCode":null,"errorMessage":"Module bindings path must be a relative path","messagePattern":"Module bindings path must be a relative path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":176,"sourceCode":"    // If you don't specify a server, we default to your default server\n    // If you don't have one of those, we default to \"maincloud\"\n    let server_from_cli = args.get_one::<String>(\"server\").map(|s| s.as_str());\n\n    let default_server_name = config.default_server_name().map(|s| s.to_string());\n\n    let mut resolved_server = server_from_cli\n        .or(default_server_name.as_deref())\n        .ok_or_else(|| anyhow::anyhow!(\"Server not specified and no default server configured.\"))?;\n\n    let cwd = std::env::current_dir()?;\n    let mut project_dir = if project_path.is_absolute() {\n        project_path.clone()\n    } else {\n        cwd.join(project_path)\n    };\n\n    if module_bindings_path.is_absolute() {\n        anyhow::bail!(\"Module bindings path must be a relative path\");\n    }\n    let mut module_bindings_dir = project_dir.join(module_bindings_path);\n\n    let mut spacetimedb_dir = match module_path_from_cli {\n        Some(path) => {\n            if path.is_absolute() {\n                path.clone()\n            } else {\n                std::env::current_dir()?.join(path)\n            }\n        }\n        None => project_dir.join(\"spacetimedb\"),\n    };\n\n    let no_config = args.get_flag(\"no_config\");\n    let skip_publish = args.get_flag(\"skip_publish\");\n    let skip_generate = args.get_flag(\"skip_generate\");\n    let dotnet_version = args.get_one::<u8>(\"dotnet_version\").map(u8::to_string);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dev.rs#L158-L194","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nspacetime dev --module-bindings-path /home/me/app/client/src/generated\n# after\nspacetime dev --module-bindings-path client/src/generated","handlingStrategy":"validation","validationCode":"# Reject absolute bindings paths before invoking dev\nBP=\"client/src/generated\"\ncase \"$BP\" in /*|?:\\\\*) echo \"must be relative\"; exit 1;; esac\nspacetime dev --module-bindings-path \"$BP\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat all paths in spacetime.json as project-relative by convention","Never let `$PWD` interpolation produce the bindings path"],"tags":["cli","path","configuration","spacetimedb"],"backgroundTag":"absolute-path-rejected","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}