Mintplex-Labs/anything-llm · critical · Error

FFMPEG binary not found.

Error message

FFMPEG binary not found.

What it means

The user-facing error from FFMPEGWrapper.ffmpegPath(). Thrown after the inner try/catch swallows any failure (no ffmpeg on PATH, empty candidate, invalid binary). This is the error callers actually catch.

Source

Thrown at collector/utils/WhisperProviders/ffmpeg/index.js:52

    if (this._ffmpegPath) return this._ffmpegPath;
    await patchShellEnvironmentPath();

    try {
      const which = process.platform === "win32" ? "where" : "which";
      const result = execSync(`${which} ffmpeg`, { encoding: "utf8" }).trim();
      const candidatePath = result?.split("\n")?.[0]?.trim();
      if (!candidatePath) throw new Error("FFMPEG candidate path not found.");
      if (!this.isValidFFMPEG(candidatePath))
        throw new Error("FFMPEG candidate path is not valid ffmpeg binary.");

      this.log(`Found FFMPEG binary at ${candidatePath}`);
      this._ffmpegPath = candidatePath;
      return this._ffmpegPath;
    } catch (error) {
      this.log(error.message);
    }

    throw new Error("FFMPEG binary not found.");
  }

  /**
   * Validates that path points to a valid ffmpeg binary.
   * Runs ffmpeg -version command.
   *
   * @param {string} pathToTest - Path of ffmpeg binary
   * @returns {boolean}
   */
  isValidFFMPEG(pathToTest) {
    try {
      if (!pathToTest || !fs.existsSync(pathToTest)) return false;
      execSync(`"${pathToTest}" -version`, { encoding: "utf8", stdio: "pipe" });
      return true;
    } catch {
      return false;
    }
  }

View on GitHub (pinned to 526360e320)

Solutions

  1. Install ffmpeg (`brew install ffmpeg` / `apt-get install ffmpeg` / add to the Dockerfile).
  2. Ensure process.env.PATH includes the ffmpeg binary directory — launch from a login shell or set PATH explicitly.
  3. Confirm `which ffmpeg` works inside the exact environment the app runs in.

Example fix

// before — relies entirely on `which`
await patchShellEnvironmentPath();
const result = execSync(`${which} ffmpeg`, { encoding: "utf8" });

// after — explicit PATH for containerized deployments
process.env.PATH = `${process.env.PATH}:/usr/local/bin:/opt/homebrew/bin`;
const result = execSync(`${which} ffmpeg`, { encoding: "utf8" });
Defensive patterns

Strategy: validation

Validate before calling

function ensureFFmpeg() {
  const { execSync } = require("child_process");
  try {
    execSync(`${process.platform === "win32" ? "where" : "which"} ffmpeg`, { stdio: "pipe" });
    return true;
  } catch { return false; }
}
// at startup: if (!ensureFFmpeg()) surface a setup error;

Try / catch

try {
  await ffmpeg.convertAudioToWav(inPath, outPath);
} catch (e) {
  if (e.message === "FFMPEG binary not found.") {
    return { error: "ffmpeg is not installed or not on PATH" };
  }
  throw e;
}

Prevention

When it happens

Trigger: `which`/`where ffmpeg` itself exits non-zero (binary not on PATH), or errors 20/21 were caught internally and execution falls through to the unconditional throw at the end of ffmpegPath().

Common situations: ffmpeg not installed; ffmpeg installed but absent from the Node process PATH (GUI launchers, minimal Docker images, systemd units); container missing the ffmpeg package.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/368731b481dc3af7. Report an issue: GitHub.