ajeetdsouza/zoxide · error · anyhow::Error

fzf returned an unknown error

Error message

fzf returned an unknown error

What it means

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

Source

Thrown at src/util.rs:148

        }
    }

    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);
        tmp_file
            .write_all(contents)
            .with_context(|| format!("could not write to file: {}", tmp_path.display()))?;

View on GitHub (pinned to 8a3f76da90)

Solutions

  1. Upgrade fzf to the latest version
  2. Report the issue with the fzf exit status if it persists

When it happens

Trigger: Thrown at src/util.rs:148 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/55ba53713a63a96a. Report an issue: GitHub.