{"record":{"id":"eb314250b233d13e","repo":"ytdl-org/youtube-dl","slug":"invalid-rendition-field","errorCode":null,"errorMessage":"Invalid rendition field.","messagePattern":"Invalid rendition field\\.","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/mtv.py","lineNumber":108,"sourceCode":"                    _, _, ext = rendition.attrib['type'].partition('/')\n                    rtmp_video_url = rendition.find('./src').text\n                    if 'error_not_available.swf' in rtmp_video_url:\n                        raise ExtractorError(\n                            '%s said: video is not available' % self.IE_NAME,\n                            expected=True)\n                    if rtmp_video_url.endswith('siteunavail.png'):\n                        continue\n                    formats.extend([{\n                        'ext': 'flv' if rtmp_video_url.startswith('rtmp') else ext,\n                        'url': rtmp_video_url,\n                        'format_id': '-'.join(filter(None, [\n                            'rtmp' if rtmp_video_url.startswith('rtmp') else None,\n                            rendition.get('bitrate')])),\n                        'width': int(rendition.get('width')),\n                        'height': int(rendition.get('height')),\n                    }])\n                except (KeyError, TypeError):\n                    raise ExtractorError('Invalid rendition field.')\n        if formats:\n            self._sort_formats(formats)\n        return formats\n\n    def _extract_subtitles(self, mdoc, mtvn_id):\n        subtitles = {}\n        for transcript in mdoc.findall('.//transcript'):\n            if transcript.get('kind') != 'captions':\n                continue\n            lang = transcript.get('srclang')\n            for typographic in transcript.findall('./typographic'):\n                sub_src = typographic.get('src')\n                if not sub_src:\n                    continue\n                ext = typographic.get('format')\n                if ext == 'cea-608':\n                    ext = 'scc'\n                subtitles.setdefault(lang, []).append({","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/mtv.py#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"pip install -U youtube-dl   # or: pip install -U yt-dlp","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"except ExtractorError as e:\n    if 'Invalid rendition field' in str(e):\n        report_upstream(url)  # schema change — extractor needs a patch\n    else:\n        raise","preventionTips":["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."],"tags":["extractor","api-change","xml","unexpected-error"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}