subhra74/xdm · error
Non-zero error code from youtube-dl:
Error message
Non-zero error code from youtube-dl:
What it means
YDLProcess.Start runs an external youtube-dl/yt-dlp process and, after it exits, throws if the exit code is non-zero. youtube-dl uses non-zero exit codes to signal download/extraction failures (network errors, unsupported URL, HTTP 403/404, missing ffmpeg, etc.). The exception message includes the numeric exit code but not stderr — that is only written to the debug log.
Solutions
- Read the debug log entry 'Non-zero error code from youtube-dl: <code>' and the captured process output to see the underlying yt-dlp error.
- Update youtube-dl/yt-dlp to the latest version (most failures are stale extractors).
- Verify ffmpeg/ffprobe are installed and on PATH if format merging/conversion was requested.
- Test the same URL directly with yt-dlp on the command line to reproduce and see the full error text.
- Retry with different format selection or pass cookies/user-agent if the site requires authentication.
Example fix
// before
ydl.Start(); // throws generic Exception on failure
// after
try
{
ydl.Start();
}
catch (Exception ex)
{
Log.Debug(ex, "ydl failed; check yt-dlp version and ffmpeg availability");
throw;
} Defensive patterns
Strategy: try-catch
Validate before calling
var which = TryRun("yt-dlp --version");
if (which == null) throw new Exception("yt-dlp not runnable"); Try / catch
try { ydlProc.Start(); }
catch (Exception ex) when (ex.Message.StartsWith("Non-zero error code from youtube-dl"))
{
Log.Error(ex, "yt-dlp failed; update yt-dlp, verify ffmpeg on PATH, check the URL");
throw;
} Prevention
- Keep yt-dlp up to date (stale extractors are the top cause)
- Test failing URLs directly on the yt-dlp CLI for full error output
- Ensure ffmpeg/ffprobe are installed for merge operations
- Capture and log stderr of the child process, not just the exit code
When it happens
Trigger: Any invocation of a ydl-based operation (download/info extraction via YDLProcess.Start) where the youtube-dl/yt-dlp process terminates with ExitCode != 0 — e.g. unsupported URL, HTTP errors fetching the video, ffmpeg missing for requested format merge, out-of-date extractor.
Common situations: Outdated youtube-dl facing a site layout change (exit code 1); requested format unavailable (exit 1); disk full or permission errors; ffmpeg not on PATH when merging formats (exit 1); site requires cookies/age verification.
Related errors
- YoutubeDL executable not found
- response.StatusDescription
- Invalid response code
- EOF :: File corrupted
- InvalidResponse
AI-assisted analysis of subhra74/xdm@1ca5a25aae (2026-09-13).
Data as JSON: /api/errors/410abc52edc7a9b4.
Report an issue: GitHub.
Appendix: source
Thrown at app/XDM/XDM.Core/YDLWrapper/YDLProcess.cs:112
ydlProc.ErrorDataReceived += (a, b) =>
{
if (b.Data != null)
{
Log.Debug(b.Data);
}
};
ydlProc.BeginOutputReadLine();
ydlProc.WaitForExit();
fs.Close();
var exitCode = ydlProc.ExitCode;
if (ydlProc.ExitCode != 0)
{
Log.Debug("Non-zero error code from youtube-dl: " + ydlProc.ExitCode);
throw new Exception("Non-zero error code from youtube-dl: " + ydlProc.ExitCode);
}
}
finally
{
ydlProc?.Dispose();
ydlProc = null;
}
}
private static YtBinaryType GetYtBinaryType(string executableName)
{
if (executableName.StartsWith("yt-dlp"))
{
return YtBinaryType.YtDlp;
}
return YtBinaryType.Yt;
}
View on GitHub (pinned to 1ca5a25aae)