MonoGame/MonoGame · error · InvalidOperationException
ffprobe exited with non-zero exit code.
Error message
ffprobe exited with non-zero exit code.
What it means
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.
Source
Thrown at MonoGame.Framework.Content.Pipeline/Audio/DefaultAudioProfile.cs:70
targetFormat = ConversionFormat.Mp3;
// Get the song output path with the target format extension.
outputFileName = Path.ChangeExtension(outputFileName, AudioHelper.GetExtension(targetFormat));
// Make sure the output folder for the file exists.
Directory.CreateDirectory(Path.GetDirectoryName(outputFileName)!);
return ConvertToFormat(content, targetFormat, quality, outputFileName);
}
public static void ProbeFormat(string sourceFile, out AudioFileType audioFileType, out AudioFormat audioFormat, out TimeSpan duration, out int loopStart, out int loopLength)
{
var ffprobeExitCode = FFprobe.Run(
$"-i \"{sourceFile}\" -show_format -show_entries streams -v quiet -of flat",
out var ffprobeStdout,
out _);
if (ffprobeExitCode != 0)
throw new InvalidOperationException("ffprobe exited with non-zero exit code.");
// Set default values if information is not available.
int averageBytesPerSecond = 0;
int bitsPerSample = 0;
int blockAlign = 0;
int channelCount = 0;
int sampleRate = 0;
int format = 0;
string? sampleFormat = null;
double durationInSeconds = 0;
var formatName = string.Empty;
try
{
var numberFormat = CultureInfo.InvariantCulture.NumberFormat;
foreach (var line in ffprobeStdout.Split(['\r', '\n', '\0'], StringSplitOptions.RemoveEmptyEntries))
{
var kv = line.Split(['='], 2);View on GitHub (pinned to 1d71bbd0ff)
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.
Example fix
# install ffprobe (Debian/Ubuntu) sudo apt-get install ffmpeg # verify ffprobe -version
Defensive patterns
Strategy: validation
Validate before calling
// Ensure ffprobe is available before building content
var ok = ExternalTool.Run("ffprobe", "-version", out _, out _);
if (ok != 0) throw new InvalidOperationException("ffprobe not available on PATH"); Try / catch
try { /* probe/import */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("ffprobe exited"))
{ /* run ffprobe manually to diagnose; check install + file integrity */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to parse ffprobe output.
- ffmpeg exited with non-zero exit code: {ffmpegStdout} {ffmp
- Calculated block align does not match RIFF {_format.BlockAli
- Probed channel count does not match RIFF: {_format.ChannelCo
- Probed audio format does not match RIFF: {_format.Format}, {
AI-assisted analysis of MonoGame/MonoGame@1d71bbd0ff (2026-08-13).
Data as JSON: /api/errors/688b4e27958db751.
Report an issue: GitHub.