{"record":{"id":"075837d9e18c2b29","repo":"Hmbown/CodeWhale","slug":"global-bundle-operations-cannot-target-workspace-config","errorCode":null,"errorMessage":"global bundle operations cannot target workspace config {}; rerun with --project or select the user-global config","messagePattern":"global bundle operations cannot target workspace config (.+?); rerun with --project or select the user-global config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":688,"sourceCode":"\nimpl BundleScope {\n    #[must_use]\n    pub fn label(self) -> &'static str {\n        match self {\n            Self::Global => \"global\",\n            Self::Project => \"project\",\n        }\n    }\n}\n\nfn validate_scope_target(scope: BundleScope, target: &Path) -> Result<()> {\n    let workspace_scoped = codewhale_config::config_path_is_workspace_scoped(target);\n    match (scope, workspace_scoped) {\n        (BundleScope::Project, false) => bail!(\n            \"--project requires a workspace config ({} is the user-global document)\",\n            target.display()\n        ),\n        (BundleScope::Global, true) => bail!(\n            \"global bundle operations cannot target workspace config {}; rerun with --project or select the user-global config\",\n            target.display()\n        ),\n        _ => {}\n    }\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// Path safety\n// ---------------------------------------------------------------------------\n\n/// Resolve `candidate` inside `base_dir`, refusing traversal and symlink\n/// escapes. Returns the resolved path or an error naming the refusal — the\n/// candidate string itself is safe to echo (it is config data, not a secret).\n/// Resolve `candidate` inside `base_dir`, refusing traversal and symlink\n/// escapes. Returns the joined path or an error naming the refusal.\n/// Reserved for path-carrying bundle sections (none shipped yet); exercised","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L670-L706","documentation":"A bundle operation with global (default) scope was pointed at a workspace-scoped config file. `validate_scope_target` refuses global operations against workspace configs and tells the caller to either use `--project` or select the user-global config. This keeps bundle scope and target document in agreement.","triggerScenarios":"Running `codewhale config bundle import` or `export` without `--project` while the targeted config path is workspace-scoped (e.g. `--config .codewhale/config.json` was passed).","commonSituations":"Explicitly passing a workspace config path but forgetting `--project`; scripts that default to a workspace config path for all commands; running an export intended for the global profile but resolving to the workspace config.","solutions":["Re-run with `--project` if you intend to operate on the workspace config.","Otherwise re-run targeting the user-global config (omit the workspace `--config` path).","Update the calling script to pass `--project` whenever its config path is workspace-scoped."],"exampleFix":"// before\ncodewhale config bundle export .codewhale/config.json bundle.zip\n// after\ncodewhale config bundle export --project .codewhale/config.json bundle.zip","handlingStrategy":"validation","validationCode":"if !args.project && codewhale_config::config_path_is_workspace_scoped(&config_path) {\n    eprintln!(\"global scope cannot target workspace config {}; add --project\", config_path.display());\n    std::process::exit(2);\n}","typeGuard":"fn requires_project_flag(p: &std::path::Path) -> bool {\n    codewhale_config::config_path_is_workspace_scoped(p)\n}","tryCatchPattern":null,"preventionTips":["Add `--project` whenever the target config lives under the workspace.","Keep scripts explicit about which config document they target.","Avoid hardcoding the global config path in project scripts."],"tags":["cli","config-scope","project-vs-global"],"backgroundTag":"invalid-cli-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}