{"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":1077,"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    if ctx.is_none()\n        && !global\n        && let Some(custom) = custom_path.as_deref()\n    {\n        // Without a repository context, only absolute/tilde paths can be resolved without `--global`.\n        let expanded = expand_tilde(custom).unwrap_or_else(|| PathBuf::from(custom));\n        if !expanded.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.\"\n            );\n        }\n    }\n\n    // Determine installation path(s). Only --detect can yield more than one, when\n    // several GitButler skills share a scope; they are all refreshed together.\n    let agent_default_path = if custom_path.is_none() && !detect {","sourceCodeStart":1059,"sourceCodeEnd":1095,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/skill/mod.rs#L1059-L1095","documentation":"`but skill install` selects the destination through either --detect (scan for existing installations) or --path (explicit directory). The pair is mutually exclusive and checked manually before any filesystem work, because supplying both makes the requested destination ambiguous.","triggerScenarios":"`but skill install --detect --path ./skills` - both flags present on the command line.","commonSituations":"Copy-pasted commands combining flags from different docs or tutorials, scripts accumulating flags over time, shell history editing.","solutions":["Remove --detect and keep --path for an explicit destination directory","Or remove --path and keep --detect to refresh an existing installation"],"exampleFix":"# before\n$ but skill install --detect --path ./skills   # fails\n# after\n$ but skill install --path ./skills             # pick one","handlingStrategy":"validation","validationCode":"// before spawning the CLI:\nif args.detect && args.path.is_some() {\n    return Err(anyhow::anyhow!(\"--detect and --path are mutually exclusive\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare the conflict in clap so it is rejected at parse time: #[arg(long, conflicts_with = \"path\")] on --detect","Validate flag combinations in wrapper scripts before invoking the CLI","Keep documented examples using only one of the two flags"],"tags":["cli","flag-conflict","skill","install","usage"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}