{"record":{"id":"560520c17a921792","repo":"clockworklabs/SpacetimeDB","slug":"module-path-project-path-and-module-b","errorCode":null,"errorMessage":"`--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.","messagePattern":"`--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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":333,"sourceCode":"        .map(|g| !g.is_empty())\n        .unwrap_or(false);\n\n    let module_path_from_cli_flag = args.value_source(\"module-path\") == Some(ValueSource::CommandLine);\n    let project_path_from_cli_flag = args.value_source(\"project-path\") == Some(ValueSource::CommandLine);\n    let module_bindings_path_from_cli_flag =\n        args.value_source(\"module-bindings-path\") == Some(ValueSource::CommandLine);\n\n    if has_publish_targets_in_config && module_path_from_cli_flag {\n        anyhow::bail!(\n            \"`--module-path` cannot be used when `spacetime.json` contains publish targets. \\\n             Remove `--module-path` or run without publish targets in config.\"\n        );\n    }\n\n    if has_generate_targets_in_config\n        && (module_path_from_cli_flag || project_path_from_cli_flag || module_bindings_path_from_cli_flag)\n    {\n        anyhow::bail!(\n            \"`--module-path`, `--project-path`, and `--module-bindings-path` cannot be used when \\\n             `spacetime.json` contains generate targets. Remove these flags or remove generate targets from config.\"\n        );\n    }\n\n    // Fetch the database name if it was passed through a CLI arg\n    let database_name_from_cli: Option<String> = args\n        .get_one::<String>(\"database\")\n        .or_else(|| args.get_one::<String>(\"database-flag\"))\n        .map(|name| {\n            if args.get_one::<String>(\"database-flag\").is_some() {\n                println!(\n                    \"{} {}\",\n                    \"Warning:\".yellow().bold(),\n                    \"--database flag is deprecated. Use positional argument instead: spacetime dev <database>\".dimmed()\n                );\n            }\n            name.clone()","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dev.rs#L315-L351","documentation":"Companion guard to the publish-target check: `spacetime dev` bails when `spacetime.json` defines generate targets AND any of `--module-path`, `--project-path`, or `--module-bindings-path` was supplied on the command line. Generate targets own their path configuration, so CLI path flags are rejected to avoid silently changing where code/bindings get written. Only true command-line values count; defaults and env-var sources do not trigger it.","triggerScenarios":"Running `spacetime dev --project-path .` or `--module-bindings-path gen` when `spacetime.json` has a non-empty `generate` array.","commonSituations":"Enabling code generation in config then reusing an old dev command that still passes path flags; CI scripts parameterized with explicit paths; migrating a project from flag-driven to config-driven layouts without cleaning up the flags.","solutions":["Remove `--module-path`, `--project-path`, and `--module-bindings-path` from the command","Configure paths inside the generate targets in `spacetime.json` instead","Or remove the generate targets from config if you want flag-driven behavior"],"exampleFix":"# before\nspacetime dev --project-path . --module-bindings-path generated\n# (spacetime.json has \"generate\": [...])\n# after\nspacetime dev  # paths come from generate targets in spacetime.json","handlingStrategy":"validation","validationCode":"# Skip path flags whenever generate targets exist\nif jq -e '.generate | length > 0' spacetime.json >/dev/null 2>&1; then\n  spacetime dev            # paths come from config\nelse\n  spacetime dev --project-path . --module-bindings-path generated\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adopting generate targets, delete stale path flags from docs and scripts","Document the chosen layout inside spacetime.json comments/README"],"tags":["cli","configuration","flag-conflict","code-generation","spacetimedb"],"backgroundTag":"config-flag-conflict","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}