gitbutlerapp/gitbutler · error
Cannot use both --detect and --path options together
Error message
Cannot use both --detect and --path options together
What it means
`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.
Source
Thrown at crates/but/src/command/skill/mod.rs:1077
SKILL_FILES.iter().all(|file| {
!file.path_components.is_empty()
&& file
.path_components
.iter()
.all(|component| !component.is_empty())
&& file
.path_components
.iter()
.all(|component| !component.contains('/') && !component.contains('\\'))
}),
"SkillFile path components must be non-empty and separator-free"
);
let mut progress = out.progress_channel();
// Validate flags
if detect && custom_path.is_some() {
anyhow::bail!("Cannot use both --detect and --path options together");
}
if ctx.is_none()
&& !global
&& let Some(custom) = custom_path.as_deref()
{
// Without a repository context, only absolute/tilde paths can be resolved without `--global`.
let expanded = expand_tilde(custom).unwrap_or_else(|| PathBuf::from(custom));
if !expanded.is_absolute() {
anyhow::bail!(
"Cannot use relative --path outside a git repository unless --global is specified.\n\
Use --global --path <path> for a global installation, use an absolute path, or run from within a repository for local installation."
);
}
}
// Determine installation path(s). Only --detect can yield more than one, when
// several GitButler skills share a scope; they are all refreshed together.
let agent_default_path = if custom_path.is_none() && !detect {View on GitHub (pinned to caf1f223d3)
Solutions
- Remove --detect and keep --path for an explicit destination directory
- Or remove --path and keep --detect to refresh an existing installation
Example fix
# before $ but skill install --detect --path ./skills # fails # after $ but skill install --path ./skills # pick one
Defensive patterns
Strategy: validation
Validate before calling
// before spawning the CLI:
if args.detect && args.path.is_some() {
return Err(anyhow::anyhow!("--detect and --path are mutually exclusive"));
} Prevention
- 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
When it happens
Trigger: `but skill install --detect --path ./skills` - both flags present on the command line.
Common situations: Copy-pasted commands combining flags from different docs or tutorials, scripts accumulating flags over time, shell history editing.
Related errors
- Could not detect an existing GitButler skill installation. R
- No supported agent was detected. In non-interactive mode, sp
- Human input required - run this in a terminal, or specify --
- Installation path {} is a file, not a directory. Please spec
- Refusing to install symlink onto existing non-symlink at '{U
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/7be3287b5ceca7bd.
Report an issue: GitHub.