ytdl-org/youtube-dl · error · HTTPError
No such file
Error message
No such file
What it means
Raised by SWFInterpreter.extract_function when the requested function is neither patched (patch_function), a previously interpreted pyfunction, a class name (constructor path), nor present in avm_class.methods. The interpreter only knows methods that were registered from the ABC's trait tables, so asking for anything else (an inherited member, a dynamic property, or a misspelled name) fails here.
Source
Thrown at devscripts/buildserver.py:359
except subprocess.CalledProcessError as e:
raise BuildError(e.output)
super(YoutubeDLBuilder, self).build()
class DownloadBuilder(object):
def __init__(self, **kwargs):
self.handler = kwargs.pop('handler')
self.srcPath = os.path.join(self.buildPath, *tuple(kwargs['path'][2:]))
self.srcPath = os.path.abspath(os.path.normpath(self.srcPath))
if not self.srcPath.startswith(self.buildPath):
raise HTTPError(self.srcPath, 401)
super(DownloadBuilder, self).__init__(**kwargs)
def build(self):
if not os.path.exists(self.srcPath):
raise HTTPError('No such file', 404)
if os.path.isdir(self.srcPath):
raise HTTPError('Is a directory: %s' % self.srcPath, 401)
self.handler.send_response(200)
self.handler.send_header('Content-Type', 'application/octet-stream')
self.handler.send_header('Content-Disposition', 'attachment; filename=%s' % os.path.split(self.srcPath)[-1])
self.handler.send_header('Content-Length', str(os.stat(self.srcPath).st_size))
self.handler.end_headers()
with open(self.srcPath, 'rb') as src:
shutil.copyfileobj(src, self.handler.wfile)
super(DownloadBuilder, self).build()
class CleanupTempDir(object):
def build(self):
try:View on GitHub (pinned to 956b8c5855)
Solutions
- Check what the class actually exposes: print(sorted(avm_class.methods)) and call the correct name.
- If the function lives on a superclass, extract that class first (extract_class(super_name)) and call extract_function on it.
- Bypass interpretation with interpreter.patch_function(avm_class, 'name', python_replacement) — the mechanism swfinterp itself provides for exactly this gap.
- Update youtube-dl / switch to yt-dlp; the extractor's expected function name may have been refreshed.
Example fix
# before func = interpreter.extract_function(avm_class, 'decrypt') sig = func([sig]) # after: patch the method with a Python implementation interpreter.patch_function(avm_class, 'decrypt', lambda args: my_decrypt(args[0])) func = interpreter.extract_function(avm_class, 'decrypt') sig = func([sig])
Defensive patterns
Strategy: fallback
Validate before calling
# check all resolution paths extract_function uses, in order
func = (interpreter._patched_functions.get((avm_class, name))
or avm_class.method_pyfunctions.get(name)
or (interpreter._classes_by_name[name].make_object()
if name in interpreter._classes_by_name else None)
or avm_class.methods.get(name))
if func is None:
raise ExtractorError('Cannot find function %s.%s' % (avm_class.name, name)) Type guard
def has_function(interp, avm_class, name: str) -> bool:
return ((avm_class, name) in interp._patched_functions
or name in avm_class.method_pyfunctions
or name in interp._classes_by_name
or name in avm_class.methods) Try / catch
from youtube_dl.utils import ExtractorError
try:
func = interpreter.extract_function(avm_class, 'decrypt')
except ExtractorError as e:
if 'Cannot find function' in str(e):
interpreter.patch_function(avm_class, 'decrypt', lambda args: py_decrypt(args[0]))
func = interpreter.extract_function(avm_class, 'decrypt')
else:
raise Prevention
- Check avm_class.methods (and the superclass) for the function name before calling.
- Use patch_function for any method you can implement in Python — it is the intended escape hatch.
- Remember constructors resolve via _classes_by_name, not methods; a missing name may be a class, not a function.
When it happens
Trigger: Calling extract_function(avm_class, 'name') where 'name' is not in avm_class.methods. Common when the method lives on a superclass or was added as a script-level function; or when an extractor's expected function name changed after a player update.
Common situations: Player SWF refactors move the deciphering function to another class or rename it; extracting a function before class initialization (cinit) has registered dynamic methods; simple name typos in custom swfinterp code.
Related errors
- Invalid path
- Missing mandatory parameter "%s"
- Invalid repository "%s"
- Unauthorized user "%s"
- Is a directory: %s
AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14).
Data as JSON: /api/errors/24e4cc2c29b16171.
Report an issue: GitHub.