{"record":{"id":"8203773ed79d4df2","repo":"ytdl-org/youtube-dl","slug":"missing-id-field-in-extractor-result","errorCode":null,"errorMessage":"Missing \"id\" field in extractor result","messagePattern":"Missing \"id\" field in extractor result","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/YoutubeDL.py","lineNumber":1649,"sourceCode":"                # see http://bugs.python.org/issue1646728)\n                try:\n                    upload_date = datetime.datetime.utcfromtimestamp(info_dict[ts_key])\n                    info_dict[date_key] = compat_str(upload_date.strftime('%Y%m%d'))\n                except (ValueError, OverflowError, OSError):\n                    pass\n\n        # Auto generate title fields corresponding to the *_number fields when missing\n        # in order to always have clean titles. This is very common for TV series.\n        if final:\n            for field in ('chapter', 'season', 'episode'):\n                if info_dict.get('%s_number' % field) is not None and not info_dict.get(field):\n                    info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field])\n\n    def process_video_result(self, info_dict, download=True):\n        assert info_dict.get('_type', 'video') == 'video'\n\n        if 'id' not in info_dict:\n            raise ExtractorError('Missing \"id\" field in extractor result')\n        if 'title' not in info_dict:\n            raise ExtractorError('Missing \"title\" field in extractor result')\n\n        def report_force_conversion(field, field_not, conversion):\n            self.report_warning(\n                '\"%s\" field is not %s - forcing %s conversion, there is an error in extractor'\n                % (field, field_not, conversion))\n\n        def sanitize_string_field(info, string_field):\n            field = info.get(string_field)\n            if field is None or isinstance(field, compat_str):\n                return\n            report_force_conversion(string_field, 'a string', 'string')\n            info[string_field] = compat_str(field)\n\n        def sanitize_numeric_fields(info):\n            for numeric_field in self._NUMERIC_FIELDS:\n                field = info.get(numeric_field)","sourceCodeStart":1631,"sourceCodeEnd":1667,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/YoutubeDL.py#L1631-L1667","documentation":"Raised by youtube_dl.utils.xpath_element when an XPath query returns no node, default is not supplied, and fatal=True. It is the library's standard 'required metadata missing' error for XML-based APIs (e.g. in metadata/manifest parsing). The name in the message is the caller-supplied name or the xpath itself, which tells you which piece of metadata the extractor considered mandatory.","triggerScenarios":"Calling xpath_element(node, '//RequiredEl', fatal=True) (or omitting default) on a document where the node is absent. In the wild: an extractor expects a mandatory XML field (title, session id, stream node) and the site's API response omits or renames it.","commonSituations":"Site API schema change renames/moves the element; geo- or auth-conditional responses that omit fields; whitespace/namespace differences making the XPath miss; anti-bot XML instead of real data.","solutions":["Update youtube-dl / switch to yt-dlp — extractor XPath breakage is fixed in releases, not at your call site.","If you call xpath_element yourself, pass a default (e.g. default=None) or fatal=False to make the miss non-fatal and branch on None.","Print the raw XML actually received (via --verbose or dumping the response) and adjust the XPath to the current schema; watch for namespaces needing wildcard paths like /*[local-name()='El'].","Supply the name= argument so the error identifies the field instead of the raw XPath."],"exampleFix":"# before\ntitle = xpath_text(doc, '//Track/Title', fatal=True)\n\n# after\ntitle = xpath_text(doc, '//Track/Title', name='track title', default=None)\nif title is None:\n    title = 'unknown'","handlingStrategy":"try-catch","validationCode":"from youtube_dl.utils import xpath_element\n\n# make the miss non-fatal before it can raise\nnode = xpath_element(doc, '//Required', name='required node',\n                      fatal=False, default=None)\nif node is None:\n    node = fallback_node_or_skip()","typeGuard":null,"tryCatchPattern":"from youtube_dl.utils import ExtractorError, xpath_element\ntry:\n    node = xpath_element(doc, '//Title', fatal=True)\nexcept ExtractorError as e:\n    if 'Could not find XML element' in str(e):\n        node = None  # degrade gracefully instead of aborting the whole run\n    else:\n        raise","preventionTips":["Pass default= or fatal=False for any element your code can live without.","Always set name= so the error identifies the logical field, aiding logs.","Dump the raw XML in verbose mode to reconcile XPaths against the real schema."],"tags":["xml","xpath","extractor","metadata"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}