{"record":{"id":"368731b481dc3af7","repo":"Mintplex-Labs/anything-llm","slug":"ffmpeg-binary-not-found","errorCode":null,"errorMessage":"FFMPEG binary not found.","messagePattern":"FFMPEG binary not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"collector/utils/WhisperProviders/ffmpeg/index.js","lineNumber":52,"sourceCode":"    if (this._ffmpegPath) return this._ffmpegPath;\n    await patchShellEnvironmentPath();\n\n    try {\n      const which = process.platform === \"win32\" ? \"where\" : \"which\";\n      const result = execSync(`${which} ffmpeg`, { encoding: \"utf8\" }).trim();\n      const candidatePath = result?.split(\"\\n\")?.[0]?.trim();\n      if (!candidatePath) throw new Error(\"FFMPEG candidate path not found.\");\n      if (!this.isValidFFMPEG(candidatePath))\n        throw new Error(\"FFMPEG candidate path is not valid ffmpeg binary.\");\n\n      this.log(`Found FFMPEG binary at ${candidatePath}`);\n      this._ffmpegPath = candidatePath;\n      return this._ffmpegPath;\n    } catch (error) {\n      this.log(error.message);\n    }\n\n    throw new Error(\"FFMPEG binary not found.\");\n  }\n\n  /**\n   * Validates that path points to a valid ffmpeg binary.\n   * Runs ffmpeg -version command.\n   *\n   * @param {string} pathToTest - Path of ffmpeg binary\n   * @returns {boolean}\n   */\n  isValidFFMPEG(pathToTest) {\n    try {\n      if (!pathToTest || !fs.existsSync(pathToTest)) return false;\n      execSync(`\"${pathToTest}\" -version`, { encoding: \"utf8\", stdio: \"pipe\" });\n      return true;\n    } catch {\n      return false;\n    }\n  }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/utils/WhisperProviders/ffmpeg/index.js#L34-L70","documentation":"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.","triggerScenarios":"`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().","commonSituations":"ffmpeg not installed; ffmpeg installed but absent from the Node process PATH (GUI launchers, minimal Docker images, systemd units); container missing the ffmpeg package.","solutions":["Install ffmpeg (`brew install ffmpeg` / `apt-get install ffmpeg` / add to the Dockerfile).","Ensure process.env.PATH includes the ffmpeg binary directory — launch from a login shell or set PATH explicitly.","Confirm `which ffmpeg` works inside the exact environment the app runs in."],"exampleFix":"// before — relies entirely on `which`\nawait patchShellEnvironmentPath();\nconst result = execSync(`${which} ffmpeg`, { encoding: \"utf8\" });\n\n// after — explicit PATH for containerized deployments\nprocess.env.PATH = `${process.env.PATH}:/usr/local/bin:/opt/homebrew/bin`;\nconst result = execSync(`${which} ffmpeg`, { encoding: \"utf8\" });","handlingStrategy":"validation","validationCode":"function ensureFFmpeg() {\n  const { execSync } = require(\"child_process\");\n  try {\n    execSync(`${process.platform === \"win32\" ? \"where\" : \"which\"} ffmpeg`, { stdio: \"pipe\" });\n    return true;\n  } catch { return false; }\n}\n// at startup: if (!ensureFFmpeg()) surface a setup error;","typeGuard":null,"tryCatchPattern":"try {\n  await ffmpeg.convertAudioToWav(inPath, outPath);\n} catch (e) {\n  if (e.message === \"FFMPEG binary not found.\") {\n    return { error: \"ffmpeg is not installed or not on PATH\" };\n  }\n  throw e;\n}","preventionTips":["Include ffmpeg in your base image / install script.","Smoke-test ffmpeg availability at app startup, not only at transcription time.","Document the ffmpeg dependency for local Whisper in setup docs."],"tags":["ffmpeg","audio","binary-resolution","environment","setup"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}