ytdl-org/youtube-dl · error · ExtractorError
Incomplete YouTube ID %s. URL %s looks truncated.
Error message
Incomplete YouTube ID %s. URL %s looks truncated.
What it means
Raised by YoutubeTruncatedIDIE, a catch-all extractor whose _VALID_URL only matches youtube.com/watch?v=<id> URLs where the video id is 1-10 characters. Real YouTube ids are exactly 11 characters, so this extractor only fires when the generic YouTube extractor (which requires 11 chars) did not match. The error is marked expected=True, so youtube-dl reports it as a clean user-facing failure rather than a bug.
Source
Thrown at youtube_dl/extractor/youtube.py:4495
'like youtube-dl '
'"https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc" '
' or simply youtube-dl BaW_jenozKc .',
expected=True)
class YoutubeTruncatedIDIE(InfoExtractor):
IE_NAME = 'youtube:truncated_id'
IE_DESC = False # Do not list
_VALID_URL = r'https?://(?:www\.)?youtube\.com/watch\?v=(?P<id>[0-9A-Za-z_-]{1,10})$'
_TESTS = [{
'url': 'https://www.youtube.com/watch?v=N_708QY7Ob',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
raise ExtractorError(
'Incomplete YouTube ID %s. URL %s looks truncated.' % (video_id, url),
expected=True)
View on GitHub (pinned to 956b8c5855)
Solutions
- Check the id in the 'v=' parameter: it must be exactly 11 characters from [0-9A-Za-z_-]; re-copy the full URL from the browser address bar
- Quote the URL on the command line (single quotes) so '&' does not background the command and drop the query string
- If the URL comes from a script or file, verify no line-wrapping/truncation happened before passing it to youtube-dl
- Confirm the video still exists by opening the URL in a browser
Example fix
# before youtube-dl https://www.youtube.com/watch?v=N_708QY7Ob # after (full 11-char id, quoted URL) youtube-dl 'https://www.youtube.com/watch?v=N_708QY7ObE'
Defensive patterns
Strategy: validation
Validate before calling
import re
def is_valid_youtube_watch_url(url):
m = re.match(r'^https?://(?:www\.)?youtube\.com/watch\?v=([0-9A-Za-z_-]{11})$', url)
return m is not None
# reject before invoking the downloader
assert is_valid_youtube_watch_url(url), 'YouTube video id must be exactly 11 chars' Try / catch
try:
ydl.download([url])
except ExtractorError as e:
if 'Incomplete YouTube ID' in str(e):
log.warning('URL truncated, re-check source: %s', url) # expected, do not retry
else:
raise Prevention
- Always quote YouTube URLs on the command line so '&' does not truncate the query string
- When generating URLs programmatically, assert the v parameter is exactly 11 characters
- Treat this expected error as bad input data: fix the URL, never retry it unchanged
When it happens
Trigger: Calling youtube-dl with a URL like 'https://www.youtube.com/watch?v=N_708QY7Ob' (id shorter than 11 chars). Typical causes: copy/paste cut the id off, a script truncated the URL, or a shell/environment variable holding the URL chopped the query string.
Common situations: URLs pasted into terminals where '&' splits the query string and only 'v=<partial>' survives; ids mangled by text editors or log truncation; feeding URLs from a file or playlist where lines were wrapped.
Related errors
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/e5f2862636e99145.
Report an issue: GitHub.