ajeetdsouza/zoxide · error · anyhow::Error

fzf returned an error

Error message

fzf returned an error

What it means

Error "fzf returned an error" thrown in ajeetdsouza/zoxide.

Source

Thrown at src/util.rs:145

            Ok(()) => Ok(None),
            Err(e) if e.kind() == io::ErrorKind::BrokenPipe => self.wait().map(Some),
            Err(e) => Err(e).context("could not write to fzf"),
        }
    }

    pub fn wait(&mut self) -> Result<String> {
        // Drop stdin to prevent deadlock.
        mem::drop(self.0.stdin.take());

        let mut stdout = self.0.stdout.take().unwrap();
        let mut output = String::new();
        stdout.read_to_string(&mut output).context("failed to read from fzf")?;

        let status = self.0.wait().context("wait failed on fzf")?;
        match status.code() {
            Some(0) => Ok(output),
            Some(1) => bail!("no match found"),
            Some(2) => bail!("fzf returned an error"),
            Some(130) => bail!(SilentExit { code: 130 }),
            Some(128..=254) | None => bail!("fzf was terminated"),
            _ => bail!("fzf returned an unknown error"),
        }
    }
}

/// Similar to [`fs::write`], but atomic (best effort on Windows).
pub fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> {
    let path = path.as_ref();
    let contents = contents.as_ref();
    let dir = path.parent().unwrap();

    // Create a tmpfile.
    let (mut tmp_file, tmp_path) = tmpfile(dir)?;
    let result = (|| {
        // Write to the tmpfile.
        _ = tmp_file.set_len(contents.len() as u64);

View on GitHub (pinned to 8a3f76da90)

Solutions

  1. Run fzf directly to see its error output
  2. Upgrade fzf to a supported version

When it happens

Trigger: Thrown at src/util.rs:145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ajeetdsouza/zoxide@8a3f76da90 (2026-08-19). Data as JSON: /api/errors/73c11fe8772216db. Report an issue: GitHub.