ytdl-org/youtube-dl · error · ExtractorError
Invalid rendition field.
Error message
Invalid rendition field.
What it means
Raised inside MTV's rendition loop when building the format dict raises KeyError or TypeError — i.e. a rendition element is missing required attributes ('type', 'width', 'height') or its values are malformed. Unlike the geo/availability errors this one is NOT expected=True, so it propagates as an unexpected extraction failure.
Source
Thrown at youtube_dl/extractor/mtv.py:108
_, _, ext = rendition.attrib['type'].partition('/')
rtmp_video_url = rendition.find('./src').text
if 'error_not_available.swf' in rtmp_video_url:
raise ExtractorError(
'%s said: video is not available' % self.IE_NAME,
expected=True)
if rtmp_video_url.endswith('siteunavail.png'):
continue
formats.extend([{
'ext': 'flv' if rtmp_video_url.startswith('rtmp') else ext,
'url': rtmp_video_url,
'format_id': '-'.join(filter(None, [
'rtmp' if rtmp_video_url.startswith('rtmp') else None,
rendition.get('bitrate')])),
'width': int(rendition.get('width')),
'height': int(rendition.get('height')),
}])
except (KeyError, TypeError):
raise ExtractorError('Invalid rendition field.')
if formats:
self._sort_formats(formats)
return formats
def _extract_subtitles(self, mdoc, mtvn_id):
subtitles = {}
for transcript in mdoc.findall('.//transcript'):
if transcript.get('kind') != 'captions':
continue
lang = transcript.get('srclang')
for typographic in transcript.findall('./typographic'):
sub_src = typographic.get('src')
if not sub_src:
continue
ext = typographic.get('format')
if ext == 'cea-608':
ext = 'scc'
subtitles.setdefault(lang, []).append({View on GitHub (pinned to 956b8c5855)
Solutions
- Update youtube-dl / switch to yt-dlp — this is almost always an out-of-date extractor versus a changed mediagen response.
- If it persists on the latest version, report the URL to the tracker so the rendition parsing can be fixed.
- Retry once to rule out a truncated/garbage XML response from the CDN.
Example fix
pip install -U youtube-dl # or: pip install -U yt-dlp
Defensive patterns
Strategy: try-catch
Try / catch
except ExtractorError as e:
if 'Invalid rendition field' in str(e):
report_upstream(url) # schema change — extractor needs a patch
else:
raise Prevention
- Pin a recently updated youtube-dl/yt-dlp — this error means the binary's parsing is stale.
- Retry once to rule out truncated CDN XML before assuming schema drift.
- Monitor extraction success rates per site to catch schema changes early.
When it happens
Trigger: A mediagen XML <rendition> lacking the 'type' key (KeyError on rendition.attrib['type']) or with non-numeric width/height (TypeError in int(...)), caught and re-raised as this generic message.
Common situations: MTV changing the mediagen schema (new rendition attributes, missing width/height on audio-only renditions); an extractor version lagging behind the site; occasionally transient CDN XML truncation.
Related errors
- Could not find video title
- Found song but don't know how to download it
- Unable to extract embedUrl
- Missing "id" field in extractor result
- Missing "title" field in extractor result
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/eb314250b233d13e.
Report an issue: GitHub.