nikivdev/code · error

fzf not found – install it for fuzzy selection

Error message

fzf not found – install it for fuzzy selection

What it means

This error is thrown by a session-picking command (fzf-based fuzzy session selector) in src/ai.rs when the external `fzf` binary cannot be located on the system PATH. The code checks `which::which("fzf")` before attempting to pipe session entries into it, and bails early with an install hint. It is a hard precondition: without fzf the fuzzy selection feature cannot run at all.

Source

Thrown at src/ai.rs:13409

                    truncate_str(&summary_clean, 60),
                    id_short
                )
            };

            entries.push(FzfSessionEntry {
                display,
                session_id: session.session_id.clone(),
                provider: session.provider,
            });
        }

        if entries.is_empty() {
            println!("No sessions available.");
            return Ok(());
        }

        if which::which("fzf").is_err() {
            bail!("fzf not found – install it for fuzzy selection");
        }

        let Some(selected) = run_session_fzf(&entries)? else {
            return Ok(());
        };

        (selected.session_id.clone(), selected.provider)
    };

    // Read and format the session history
    let history = read_session_history(&session_id, session_provider)?;

    // Copy to clipboard
    copy_to_clipboard(&history)?;

    let line_count = history.lines().count();
    println!("Copied session history ({} lines) to clipboard", line_count);

View on GitHub (pinned to a747e741ae)

Solutions

  1. Install fzf: macOS `brew install fzf`, Debian/Ubuntu `apt install fzf`, Fedora `dnf install fzf`, Arch `pacman -S fzf`
  2. Verify it is reachable: `which fzf` (or `fzf --version`) in the same shell/environment that runs the tool
  3. If fzf is installed but not found, fix PATH (e.g. add ~/.fzf/bin or ~/.local/bin to PATH) or symlink it into a PATH directory
  4. As a workaround, pass the session id directly if the command supports a non-interactive session argument

Example fix

// before (shell)
$ myapp sessions pick
Error: fzf not found – install it for fuzzy selection
// after (shell)
$ brew install fzf   # or apt install fzf
$ which fzf
/usr/local/bin/fzf
$ myapp sessions pick
Defensive patterns

Strategy: validation

Validate before calling

use std::process::Command;
fn fzf_available() -> bool {
    Command::new("fzf").arg("--version").output()
        .map(|o| o.status.success()).unwrap_or(false)
}
if !fzf_available() {
    eprintln!("Install fzf first: brew install fzf / apt install fzf");
    return;
}

Try / catch

match run_session_picker() {
    Err(e) if e.to_string().contains("fzf not found") => {
        eprintln!("fzf missing; install it or pass --session <id> to skip fuzzy selection");
    }
    Err(e) => eprintln!("session pick failed: {e}"),
    Ok(sel) => { /* use selection */ }
}

Prevention

When it happens

Trigger: Invoking the session list/pick command (the function containing this bail) on a machine where `fzf` is not installed or not on PATH; running in a minimal container or CI environment that lacks fzf; fzf installed via a non-PATH method (e.g. only in a GUI app bundle).

Common situations: Fresh developer machines or dotfiles not yet set up; Docker images built from slim base images; Windows/WSL setups where fzf was installed only inside WSL or only on Windows; PATH broken in the shell that launched the tool.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/d83ea5a7e4c2af7d. Report an issue: GitHub.