clockworklabs/SpacetimeDB · error · anyhow::Error
`--module-path`, `--project-path`, and…
Error message
`--module-path`, `--project-path`, and `--module-bindings-path` cannot be used when `spacetime.json` contains generate targets. Remove these flags or remove generate targets from config.
What it means
The counterpart guard for generate targets: when spacetime.json declares generate entries, none of --module-path, --project-path, or --module-bindings-path may come from the CLI, because those paths are owned by the per-entry configuration and a CLI value would conflict with it.
Solutions
- Remove the three path flags and configure paths per generate entry in spacetime.json
- Remove the generate targets from spacetime.json if you want CLI-driven paths
Example fix
# before spacetime dev --module-bindings-path bindings # spacetime.json has "generate": [ ... ] # after spacetime dev # paths come from the generate entries
Defensive patterns
Strategy: validation
Validate before calling
// with generate targets configured, none of the three path flags may come from the CLI
let has_generate_targets = !spacetime_json.generate.as_ref().map_or(false, Vec::is_empty);
if has_generate_targets {
for f in ["--module-path", "--project-path", "--module-bindings-path"] {
assert!(!cli_has_flag(f), "{f} conflicts with generate targets in spacetime.json");
}
} Prevention
- Own path configuration in spacetime.json once generate entries exist
- Remove hardcoded path flags from CI and aliases during migration
When it happens
Trigger: spacetime.json has a non-empty generate array and any of --module-path, --project-path, or --module-bindings-path is supplied on the command line.
Common situations: Reusing an old dev command line after adding generate entries to spacetime.json; wrapper scripts that always pass the three path flags.
Related errors
- Cannot use generate-entry-specific arguments
- database is a required field in publish config
- `--module-path` cannot be used when `spacetime.json`…
- Aborted.
- Cannot continue without a module path.
AI-assisted analysis of clockworklabs/SpacetimeDB@3653d2ed49 (2026-08-20).
Data as JSON: /api/errors/560520c17a921792.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/subcommands/dev.rs:339
.map(|g| !g.is_empty())
.unwrap_or(false);
let module_path_from_cli_flag = args.value_source("module-path") == Some(ValueSource::CommandLine);
let project_path_from_cli_flag = args.value_source("project-path") == Some(ValueSource::CommandLine);
let module_bindings_path_from_cli_flag =
args.value_source("module-bindings-path") == Some(ValueSource::CommandLine);
if has_publish_targets_in_config && module_path_from_cli_flag {
anyhow::bail!(
"`--module-path` cannot be used when `spacetime.json` contains publish targets. \
Remove `--module-path` or run without publish targets in config."
);
}
if has_generate_targets_in_config
&& (module_path_from_cli_flag || project_path_from_cli_flag || module_bindings_path_from_cli_flag)
{
anyhow::bail!(
"`--module-path`, `--project-path`, and `--module-bindings-path` cannot be used when \
`spacetime.json` contains generate targets. Remove these flags or remove generate targets from config."
);
}
// Fetch the database name if it was passed through a CLI arg
let database_name_from_cli: Option<String> = args
.get_one::<String>("database")
.or_else(|| args.get_one::<String>("database-flag"))
.map(|name| {
if args.get_one::<String>("database-flag").is_some() {
println!(
"{} {}",
"Warning:".yellow().bold(),
"--database flag is deprecated. Use positional argument instead: spacetime dev <database>".dimmed()
);
}
name.clone()View on GitHub (pinned to 3653d2ed49)