{"record":{"id":"7be3287b5ceca7bd","repo":"gitbutlerapp/gitbutler","slug":"cannot-use-both-detect-and-path-options-togeth","errorCode":null,"errorMessage":"Cannot use both --detect and --path options together","messagePattern":"Cannot use both --detect and --path options together","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":1261,"sourceCode":"        SKILL_FILES.iter().all(|file| {\n            !file.path_components.is_empty()\n                && file\n                    .path_components\n                    .iter()\n                    .all(|component| !component.is_empty())\n                && file\n                    .path_components\n                    .iter()\n                    .all(|component| !component.contains('/') && !component.contains('\\\\'))\n        }),\n        \"SkillFile path components must be non-empty and separator-free\"\n    );\n\n    let mut progress = out.progress_channel();\n\n    // Validate flags\n    if detect && custom_path.is_some() {\n        anyhow::bail!(\"Cannot use both --detect and --path options together\");\n    }\n    // Only a local scope needs the repository: global installs resolve against\n    // the home directory and absolute or tilde paths need no base at all.\n    let custom_is_absolute = custom_path.as_deref().is_some_and(|custom| {\n        expand_tilde(custom)\n            .unwrap_or_else(|| PathBuf::from(custom))\n            .is_absolute()\n    });\n    let mut ctx = if global || custom_is_absolute {\n        None\n    } else {\n        repository_context(current_dir)?\n    };\n    let ctx = ctx.as_mut();\n    if ctx.is_none() && !global && custom_path.is_some() && !custom_is_absolute {\n        anyhow::bail!(\n            \"Cannot use relative --path outside a git repository unless --global is specified.\\n\\\n             Use --global --path <path> for a global installation, use an absolute path, or run from within a repository for local installation.\"","sourceCodeStart":1243,"sourceCodeEnd":1279,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/skill/mod.rs#L1243-L1279","documentation":"`install_skill` treats `--detect` (auto-discover and update existing installations) and `--path` (explicit directory) as mutually exclusive ways to choose install locations. Passing both is ambiguous, so it bails during flag validation.","triggerScenarios":"Running `but skill install --detect --path <dir>` (any subcommand routed through install_skill with both flags set).","commonSituations":"Copy-pasting flag examples together; scripts that always append `--path` while a wrapper adds `--detect`.","solutions":["Remove `--path` if you want auto-detection of existing installations.","Remove `--detect` if you want to install into the explicitly given `--path`."],"exampleFix":"// before\nbut skill install --detect --path ~/.claude/skills/gitbutler\n// error: Cannot use both --detect and --path options together\n\n// after\nbut skill install --path ~/.claude/skills/gitbutler","handlingStrategy":"validation","validationCode":"# shell\nif [ -n \"$DETECT\" ] && [ -n \"$PATH_OPT\" ]; then echo \"choose --detect OR --path\"; exit 1; fi","typeGuard":null,"tryCatchPattern":"but skill install --detect 2>err.log || { grep -q 'both --detect and --path' err.log && echo 'remove one of the flags'; }","preventionTips":["Decide between auto-detection and an explicit path before composing the command.","Keep flag sets for wrappers/scripts non-overlapping.","Read `but skill install --help` flag descriptions when combining flags."],"tags":["cli","flags","conflicting-options"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}