{"record":{"id":"246403e2331dc699","repo":"Mintplex-Labs/anything-llm","slug":"ffmpeg-conversion-failed","errorCode":null,"errorMessage":"FFMPEG conversion failed","messagePattern":"FFMPEG conversion failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"collector/utils/WhisperProviders/ffmpeg/index.js","lineNumber":108,"sourceCode":"      await this.ffmpegPath(),\n      [\n        \"-i\",\n        inputPath,\n        \"-ar\",\n        \"16000\",\n        \"-ac\",\n        \"1\",\n        \"-acodec\",\n        \"pcm_f32le\",\n        \"-y\",\n        outputPath,\n      ],\n      { encoding: \"utf8\" }\n    );\n\n    // ffmpeg writes progress to stderr\n    if (result.stderr) this.log(result.stderr.trim());\n    if (result.status !== 0) throw new Error(`FFMPEG conversion failed`);\n    this.log(`Conversion complete: ${path.basename(outputPath)}`);\n    return true;\n  }\n}\n\nmodule.exports = { FFMPEGWrapper };\n","sourceCodeStart":90,"sourceCodeEnd":115,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/utils/WhisperProviders/ffmpeg/index.js#L90-L115","documentation":"After spawnSync runs ffmpeg with the conversion args, if result.status !== 0 the wrapper throws. ffmpeg writes its diagnostics to stderr, which is logged just before the throw — so the real reason is in the logs, not the exception text.","triggerScenarios":"ffmpeg exited non-zero: corrupt/unreadable input, unsupported input codec, missing pcm_f32le encoder, disk full, outputPath directory unwritable, or an invalid output path.","commonSituations":"Input is not real audio (wrong MIME); a stripped ffmpeg build lacking pcm_f32le; outputPath on a read-only/full volume; truncated download fed as input.","solutions":["Read the logged stderr line — it carries ffmpeg's actual error reason.","Reproduce manually: `ffmpeg -i <input> -ar 16000 -ac 1 -acodec pcm_f32le -y <out>`.","Confirm the build has pcm_f32le: `ffmpeg -encoders | grep pcm_f32le`.","Verify the output directory is writable and has free space."],"exampleFix":"// before\nif (result.status !== 0) throw new Error(`FFMPEG conversion failed`);\n\n// after — surface ffmpeg's stderr in the exception\nif (result.status !== 0) {\n  const detail = (result.stderr || \"\").trim().split(\"\\n\").pop();\n  throw new Error(`FFMPEG conversion failed (status ${result.status}): ${detail}`);\n}","handlingStrategy":"try-catch","validationCode":"const { spawnSync } = require(\"child_process\");\nfunction inputDecodable(input) {\n  const r = spawnSync(\"ffmpeg\", [\"-i\", input, \"-f\", \"null\", \"-\"], { stdio: \"pipe\" });\n  // ffmpeg returns non-zero but still decodes; rely on stderr codec lines instead if needed\n  return r.stderr && /Audio:/.test(r.stderr);\n}","typeGuard":null,"tryCatchPattern":"try { await ffmpeg.convertAudioToWav(inPath, outPath); }\ncatch (e) {\n  if (e.message === \"FFMPEG conversion failed\") {\n    /* check server logs for the ffmpeg stderr line just before this throw */\n    return null;\n  }\n  throw e;\n}","preventionTips":["Validate the input is a real audio file before conversion.","Use a ffmpeg build with a full encoder set (not a minimal distro).","Log result.stderr alongside the exception for diagnostics."],"tags":["ffmpeg","audio","conversion","encoding"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}