{"record":{"id":"24e4cc2c29b16171","repo":"ytdl-org/youtube-dl","slug":"no-such-file","errorCode":null,"errorMessage":"No such file","messagePattern":"No such file","errorType":"http","errorClass":"HTTPError","httpStatus":404,"severity":"error","filePath":"devscripts/buildserver.py","lineNumber":359,"sourceCode":"        except subprocess.CalledProcessError as e:\n            raise BuildError(e.output)\n\n        super(YoutubeDLBuilder, self).build()\n\n\nclass DownloadBuilder(object):\n    def __init__(self, **kwargs):\n        self.handler = kwargs.pop('handler')\n        self.srcPath = os.path.join(self.buildPath, *tuple(kwargs['path'][2:]))\n        self.srcPath = os.path.abspath(os.path.normpath(self.srcPath))\n        if not self.srcPath.startswith(self.buildPath):\n            raise HTTPError(self.srcPath, 401)\n\n        super(DownloadBuilder, self).__init__(**kwargs)\n\n    def build(self):\n        if not os.path.exists(self.srcPath):\n            raise HTTPError('No such file', 404)\n        if os.path.isdir(self.srcPath):\n            raise HTTPError('Is a directory: %s' % self.srcPath, 401)\n\n        self.handler.send_response(200)\n        self.handler.send_header('Content-Type', 'application/octet-stream')\n        self.handler.send_header('Content-Disposition', 'attachment; filename=%s' % os.path.split(self.srcPath)[-1])\n        self.handler.send_header('Content-Length', str(os.stat(self.srcPath).st_size))\n        self.handler.end_headers()\n\n        with open(self.srcPath, 'rb') as src:\n            shutil.copyfileobj(src, self.handler.wfile)\n\n        super(DownloadBuilder, self).build()\n\n\nclass CleanupTempDir(object):\n    def build(self):\n        try:","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/devscripts/buildserver.py#L341-L377","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nfunc = interpreter.extract_function(avm_class, 'decrypt')\nsig = func([sig])\n\n# after: patch the method with a Python implementation\ninterpreter.patch_function(avm_class, 'decrypt', lambda args: my_decrypt(args[0]))\nfunc = interpreter.extract_function(avm_class, 'decrypt')\nsig = func([sig])","handlingStrategy":"fallback","validationCode":"# check all resolution paths extract_function uses, in order\nfunc = (interpreter._patched_functions.get((avm_class, name))\n        or avm_class.method_pyfunctions.get(name)\n        or (interpreter._classes_by_name[name].make_object()\n            if name in interpreter._classes_by_name else None)\n        or avm_class.methods.get(name))\nif func is None:\n    raise ExtractorError('Cannot find function %s.%s' % (avm_class.name, name))","typeGuard":"def has_function(interp, avm_class, name: str) -> bool:\n    return ((avm_class, name) in interp._patched_functions\n            or name in avm_class.method_pyfunctions\n            or name in interp._classes_by_name\n            or name in avm_class.methods)","tryCatchPattern":"from youtube_dl.utils import ExtractorError\ntry:\n    func = interpreter.extract_function(avm_class, 'decrypt')\nexcept ExtractorError as e:\n    if 'Cannot find function' in str(e):\n        interpreter.patch_function(avm_class, 'decrypt', lambda args: py_decrypt(args[0]))\n        func = interpreter.extract_function(avm_class, 'decrypt')\n    else:\n        raise","preventionTips":["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."],"tags":["swf","method-lookup","interpreter"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}