{"record":{"id":"688b4e27958db751","repo":"MonoGame/MonoGame","slug":"ffprobe-exited-with-non-zero-exit-code","errorCode":null,"errorMessage":"ffprobe exited with non-zero exit code.","messagePattern":"ffprobe exited with non-zero exit code\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs","lineNumber":70,"sourceCode":"                targetFormat = ConversionFormat.Mp3;\n\n            // Get the song output path with the target format extension.\n            outputFileName = Path.ChangeExtension(outputFileName, AudioHelper.GetExtension(targetFormat));\n\n            // Make sure the output folder for the file exists.\n            Directory.CreateDirectory(Path.GetDirectoryName(outputFileName)!);\n\n            return ConvertToFormat(content, targetFormat, quality, outputFileName);\n        }\n\n        public static void ProbeFormat(string sourceFile, out AudioFileType audioFileType, out AudioFormat audioFormat, out TimeSpan duration, out int loopStart, out int loopLength)\n        {\n            var ffprobeExitCode = FFprobe.Run(\n                $\"-i \\\"{sourceFile}\\\" -show_format -show_entries streams -v quiet -of flat\",\n                out var ffprobeStdout,\n                out _);\n            if (ffprobeExitCode != 0)\n                throw new InvalidOperationException(\"ffprobe exited with non-zero exit code.\");\n\n            // Set default values if information is not available.\n            int averageBytesPerSecond = 0;\n            int bitsPerSample = 0;\n            int blockAlign = 0;\n            int channelCount = 0;\n            int sampleRate = 0;\n            int format = 0;\n            string? sampleFormat = null;\n            double durationInSeconds = 0;\n            var formatName = string.Empty;\n\n            try\n            {\n                var numberFormat = CultureInfo.InvariantCulture.NumberFormat;\n                foreach (var line in ffprobeStdout.Split(['\\r', '\\n', '\\0'], StringSplitOptions.RemoveEmptyEntries))\n                {\n                    var kv = line.Split(['='], 2);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/MonoGame/MonoGame/blob/1d71bbd0ff4071a03caa583aa3bc56b85924a819/MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs#L52-L88","documentation":"Thrown by DefaultAudioProfile.ProbeFormat when the ffprobe process returns a non-zero exit code. ProbeFormat shells out to ffprobe to read container/stream metadata before any RIFF validation; if ffprobe cannot analyze the file (or is missing/broken), probing aborts. The exception does not include ffprobe's stderr, so the underlying reason must be reproduced manually.","triggerScenarios":"ffprobe is not installed or not on PATH (though a missing binary throws earlier in ExternalTool.FindCommand). The input file is corrupt, zero-length, truncated, or in a format ffprobe cannot parse. ffprobe crashes or times out on a pathological file.","commonSituations":"Building content on a machine without ffmpeg/ffprobe installed (common on fresh CI or new dev machines). A corrupt or non-audio file passed to an audio importer. A truncated download or source-control-corrupted asset. ffprobe version incompatibility.","solutions":["Install ffmpeg (which bundles ffprobe) and ensure it is on PATH, or place the binary in the pipeline's expected subfolder.","Run `ffprobe -i \"<file>\" -show_format -show_entries streams -v quiet -of flat` manually to see the actual error.","Replace or re-download the source file if it is corrupt/truncated.","Verify the file is a valid audio container and not a mislabeled non-audio file."],"exampleFix":"# install ffprobe (Debian/Ubuntu)\nsudo apt-get install ffmpeg\n# verify\nffprobe -version","handlingStrategy":"validation","validationCode":"// Ensure ffprobe is available before building content\nvar ok = ExternalTool.Run(\"ffprobe\", \"-version\", out _, out _);\nif (ok != 0) throw new InvalidOperationException(\"ffprobe not available on PATH\");","typeGuard":null,"tryCatchPattern":"try { /* probe/import */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"ffprobe exited\"))\n{ /* run ffprobe manually to diagnose; check install + file integrity */ }","preventionTips":["Install ffmpeg/ffprobe and verify with `ffprobe -version` before building content.","Pre-validate source files with ffprobe in a CI setup step.","Keep ffprobe version consistent across dev and CI machines."],"tags":["audio","content-pipeline","ffprobe","ffmpeg","external-tool","environment","corrupt-file"],"backgroundTag":null,"analyzedSha":"1d71bbd0ff4071a03caa583aa3bc56b85924a819","analyzedAt":"2026-08-13T17:10:33.625Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}