ytdl-org/youtube-dl · error · ExtractorError
Missing "id" field in extractor result
Error message
Missing "id" field in extractor result
What it means
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.
Source
Thrown at youtube_dl/YoutubeDL.py:1649
# see http://bugs.python.org/issue1646728)
try:
upload_date = datetime.datetime.utcfromtimestamp(info_dict[ts_key])
info_dict[date_key] = compat_str(upload_date.strftime('%Y%m%d'))
except (ValueError, OverflowError, OSError):
pass
# Auto generate title fields corresponding to the *_number fields when missing
# in order to always have clean titles. This is very common for TV series.
if final:
for field in ('chapter', 'season', 'episode'):
if info_dict.get('%s_number' % field) is not None and not info_dict.get(field):
info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field])
def process_video_result(self, info_dict, download=True):
assert info_dict.get('_type', 'video') == 'video'
if 'id' not in info_dict:
raise ExtractorError('Missing "id" field in extractor result')
if 'title' not in info_dict:
raise ExtractorError('Missing "title" field in extractor result')
def report_force_conversion(field, field_not, conversion):
self.report_warning(
'"%s" field is not %s - forcing %s conversion, there is an error in extractor'
% (field, field_not, conversion))
def sanitize_string_field(info, string_field):
field = info.get(string_field)
if field is None or isinstance(field, compat_str):
return
report_force_conversion(string_field, 'a string', 'string')
info[string_field] = compat_str(field)
def sanitize_numeric_fields(info):
for numeric_field in self._NUMERIC_FIELDS:
field = info.get(numeric_field)View on GitHub (pinned to 956b8c5855)
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.
Example fix
# before
title = xpath_text(doc, '//Track/Title', fatal=True)
# after
title = xpath_text(doc, '//Track/Title', name='track title', default=None)
if title is None:
title = 'unknown' Defensive patterns
Strategy: try-catch
Validate before calling
from youtube_dl.utils import xpath_element
# make the miss non-fatal before it can raise
node = xpath_element(doc, '//Required', name='required node',
fatal=False, default=None)
if node is None:
node = fallback_node_or_skip() Try / catch
from youtube_dl.utils import ExtractorError, xpath_element
try:
node = xpath_element(doc, '//Title', fatal=True)
except ExtractorError as e:
if 'Could not find XML element' in str(e):
node = None # degrade gracefully instead of aborting the whole run
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Missing "title" field in extractor result
- No video formats found!
- Failed to get the video URL
- Invalid rendition field.
- Could not find video title
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/8203773ed79d4df2.
Report an issue: GitHub.