Panniantong/Agent-Reach · error · TranscribeError

yt-dlp produced no output file (source may exceed {limit_mib

Error message

yt-dlp produced no output file (source may exceed {limit_mib} MiB limit)

What it means

Raised by download_audio (transcribe.py:273-278) when yt-dlp exits successfully but no source.* file appears in out_dir. The most common cause is baked into the command: --max-filesize 512MiB makes yt-dlp silently skip downloads it estimates as over the limit, exiting 0 with no output. The hint in the message ('source may exceed 512 MiB limit') reflects that.

Source

Thrown at agent_reach/transcribe.py:276

            "-x",
            "--audio-format",
            "m4a",
            "--audio-quality",
            "0",
            "--no-playlist",
            "--max-filesize",
            str(MAX_SOURCE_BYTES),
            "-o",
            str(template),
            "--",
            url,
        ],
        timeout=1800,  # long podcasts over slow networks — generous but bounded
    )
    files = sorted(out_dir.glob("source.*"))
    if not files:
        limit_mib = MAX_SOURCE_BYTES // (1024 * 1024)
        raise TranscribeError(
            f"yt-dlp produced no output file (source may exceed {limit_mib} MiB limit)"
        )
    audio = files[0]
    _require_size_at_most(audio, MAX_SOURCE_BYTES, "downloaded source")
    return audio


def compress_audio(src: Path, out_dir: Path) -> Path:
    """Re-encode to mono / 16kHz / 32kbps m4a — keeps most content under 25MB."""
    _require("ffmpeg")
    dst = out_dir / "compressed.m4a"
    _run(
        [
            "ffmpeg",
            "-loglevel",
            "error",
            "-y",
            "-i",

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Check the actual size: yt-dlp --simulate -j -- <url> | jq '.filesize_approx' — if near/over 512 MiB, pick a lower-bitrate format or trim
  2. Download out-of-band with yt-dlp choosing a smaller format (-f 'bestaudio[abr<=128]'), then pass the local file to transcribe()
  3. Ensure out_dir is a fresh, empty directory per call
  4. Run yt-dlp manually with the same flags minus --max-filesize to see the real failure mode

Example fix

# before
download_audio(url, out_dir)  # yt-dlp produced no output file (source may exceed 512 MiB limit)

# after: force a compact audio format out-of-band
subprocess.run(["yt-dlp", "-x", "--audio-format", "m4a", "--audio-quality", "5",
                "-f", "bestaudio[abr<=128]/bestaudio", "-o", "src.m4a", "--", url], check=True)
text = transcribe("src.m4a")
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, json

def within_source_budget(url: str, max_bytes: int = 512 * 1024 * 1024) -> bool:
    out = subprocess.run(["yt-dlp", "--simulate", "-j", "--", url],
                         capture_output=True, text=True)
    if out.returncode != 0:
        return False
    info = json.loads(out.stdout)
    size = info.get("filesize_approx") or info.get("filesize") or 0
    return size <= max_bytes

Try / catch

from agent_reach.transcribe import TranscribeError
try:
    transcribe(url)
except TranscribeError as e:
    if "produced no output file" in str(e):
        # download out-of-band with a size-capped format, then pass the local path
        ...
    raise

Prevention

When it happens

Trigger: A video/audio whose estimated filesize exceeds MAX_SOURCE_BYTES (512 MiB) — yt-dlp aborts before writing; also sites that extract to a format the -x --audio-format m4a post-processing chain yields nothing for, or a URL where yt-dlp downloads to a different filename pattern (template mismatch is prevented here by the fixed -o template, so size-skip dominates).

Common situations: Long lossless-audio uploads (FLAC/WAV concerts), high-bitrate 4-hour streams, or a reused out_dir where a previous failed run left stale state. Note a reused out_dir with an old source.* file would instead satisfy the glob with the stale file — always use a fresh dir.

Related errors


AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14). Data as JSON: /api/errors/dfbcb33d6a44763a. Report an issue: GitHub.