Mintplex-Labs/anything-llm · error · Error

FFMPEG candidate path is not valid ffmpeg binary.

Error message

FFMPEG candidate path is not valid ffmpeg binary.

What it means

Thrown (and caught/logged) when `which` returns a path but isValidFFMPEG returns false — the file does not exist, is not executable, or running `"<path>" -version` exits non-zero. Like error 20 it is swallowed by the surrounding try/catch and the caller sees "FFMPEG binary not found." instead.

Source

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

  /**
   * Locates ffmpeg binary.
   * Uses fix-path on non-Windows platforms to ensure we can find ffmpeg.
   *
   * @returns {Promise<string>} Path to ffmpeg binary
   * @throws {Error}
   */
  async ffmpegPath() {
    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}
   */

View on GitHub (pinned to 526360e320)

Solutions

  1. Inspect the path `which ffmpeg` prints: `ls -la <path>` and run `<path> -version` manually.
  2. Reinstall ffmpeg cleanly: `brew reinstall ffmpeg` or `apt install --reinstall ffmpeg`.
  3. Remove stale symlinks or PATH entries pointing at dead locations.

Example fix

// before
execSync(`"${pathToTest}" -version`, { encoding: "utf8", stdio: "pipe" });

// after — capture why validation failed for diagnostics
try {
  execSync(`"${pathToTest}" -version`, { encoding: "utf8", stdio: "pipe" });
  return true;
} catch (e) {
  console.warn(`ffmpeg at ${pathToTest} failed -version: ${e.message}`);
  return false;
}
Defensive patterns

Strategy: validation

Validate before calling

const fs = require("fs");
const { execSync } = require("child_process");
function ffmpegBinaryWorks(candidate) {
  if (!candidate || !fs.existsSync(candidate)) return false;
  try {
    execSync(`"${candidate}" -version`, { encoding: "utf8", stdio: "pipe" });
    return true;
  } catch { return false; }
}

Try / catch

try { await ffmpeg.ffmpegPath(); }
catch (e) {
  // 21 is swallowed; caller sees error 22
  if (e.message === "FFMPEG binary not found.") { /* reinstall / fix PATH */ }
  throw e;
}

Prevention

When it happens

Trigger: isValidFFMPEG fails: !fs.existsSync(pathToTest) is true, or `execSync(`"${pathToTest}" -version`)` throws (broken symlink, non-executable, wrong binary, ffmpeg crash on -version).

Common situations: ffmpeg was uninstalled leaving a dangling symlink; execute permission stripped (chmod -x); a partial/broken ffmpeg build; PATH points to a wrapper script that errors out.

Related errors


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