gitbutlerapp/gitbutler · error

Could not detect an existing GitButler skill…

Error message

Could not detect an existing GitButler skill installation.
Run `but skill install` to create one, or use `--path <dir>` to choose a location.

What it means

`but skill` needs to know where an existing GitButler skill bundle is installed so it can update or manage it. `detect_install_paths` scans the known agent skill directories (e.g. Claude, Cursor) and bails with this error when none of them contain a GitButler installation. It is a guard so the CLI never edits a skill bundle it cannot locate.

Solutions

  1. Run `but skill install` to create a fresh installation.
  2. Re-run with `--path <dir>` pointing at the existing skill directory.
  3. Verify the agent's skill directory (e.g. ~/.claude/skills) actually contains the GitButler skill files.

Example fix

// before
but skill update
// error: Could not detect an existing GitButler skill installation.

// after
but skill update --path ~/.claude/skills/gitbutler
Defensive patterns

Strategy: fallback

Validate before calling

if [ ! -d ~/.claude/skills/gitbutler ]; then but skill install --path ~/.claude/skills/gitbutler; fi

Try / catch

but skill update --path "$SKILL_DIR" || but skill install --path "$SKILL_DIR"

Prevention

When it happens

Trigger: Running `but skill` management commands (via install_skill -> detect_install_paths) without `--path` when no supported agent directory contains a GitButler skill installation, e.g. before ever running `but skill install`.

Common situations: Fresh machine where skills were never installed; skills installed to a custom, non-standard directory the detector does not scan; running from an environment (CI, script) with a different HOME so the agent directories aren't where expected.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/b69acd18092fde35. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/skill/mod.rs:985

/// Returns every GitButler skill in the highest-priority scope that has one
/// (local before global), so `--detect` refreshes them all instead of forcing a
/// choice between them. Filtering to a single scope keeps a repo-local `--detect`
/// from reaching into global installs.
fn detect_install_paths(ctx: Option<&mut Context>, global: bool) -> Result<Vec<PathBuf>> {
    let installations = find_all_installations(ctx, true, !global)?;

    for scope in [SCOPE_LOCAL, SCOPE_GLOBAL] {
        let paths: Vec<PathBuf> = installations
            .iter()
            .filter(|(_, _, s)| *s == scope)
            .map(|(path, _, _)| path.clone())
            .collect();
        if !paths.is_empty() {
            return Ok(paths);
        }
    }

    anyhow::bail!(
        "Could not detect an existing GitButler skill installation.\n\
         Run `but skill install` to create one, or use `--path <dir>` to choose a location."
    )
}

fn prompt_for_install_scope(
    input: &mut crate::utils::InputOutputChannel<'_>,
    progress: &mut impl std::io::Write,
) -> Result<InstallScope> {
    let t = theme::get();
    writeln!(progress)?;
    writeln!(
        progress,
        "{}",
        t.important.paint("Select installation scope:")
    )?;
    writeln!(progress)?;

View on GitHub (pinned to 58e5313667)