{"record":{"id":"1fdb2b31abb3786f","repo":"ytdl-org/youtube-dl","slug":"is-a-directory-s","errorCode":null,"errorMessage":"Is a directory: %s","messagePattern":"Is a directory: (.+?)","errorType":"http","errorClass":"HTTPError","httpStatus":401,"severity":"error","filePath":"devscripts/buildserver.py","lineNumber":361,"sourceCode":"\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:\n            rmtree(self.basePath)\n        except Exception as e:","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/devscripts/buildserver.py#L343-L379","documentation":"Raised inside the AVM2 interpreter loop when bytecode calls a property on the String class object itself (callproperty with obj == StringClass) and the method name is anything other than the 'String' constructor. swfinterp simply has no implementations for String's static methods, so any SWF that calls e.g. String.fromCharCode hits this NotImplementedError mid-execution.","triggerScenarios":"Interpreted ActionScript executes String.<something>(...) as a static call — String.fromCharCode(code) is by far the most common in signature-scrambling players. The interpreter's callproperty branch matches obj == StringClass, mname != 'String', and raises.","commonSituations":"A site's player SWF uses String.fromCharCode in its signature algorithm; youtube-dl's interpreter runs it and dies. Appears suddenly when the site rotates its player, since old players happened not to use that call.","solutions":["Extend the StringClass branch in swfinterp.py to handle the needed static method (fromCharCode is a two-line addition using chr()).","Use patch_function to replace the calling method with a Python implementation so the unsupported call is never executed.","Update youtube-dl or use yt-dlp, where the algorithm is typically reimplemented natively."],"exampleFix":"# before (swfinterp.py, callproperty on StringClass)\nelse:\n    raise NotImplementedError(\n        'Function String.%s is not yet implemented' % mname)\n\n# after\nelif mname == 'fromCharCode':\n    res = ''.join(chr(a) for a in args)\n    stack.append(res)\n    continue\nelse:\n    raise NotImplementedError(\n        'Function String.%s is not yet implemented' % mname)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = func(args)\nexcept NotImplementedError as e:\n    if 'Function String.' in str(e):\n        # e.g. String.fromCharCode — supply it via a patched caller\n        interpreter.patch_function(avm_class, caller_name,\n                                   lambda a: py_equivalent(a))\n        result = func(args)\n    else:\n        raise","preventionTips":["Extend the StringClass callproperty branch with the static methods your SWFs use (fromCharCode is trivial).","Patch the calling ActionScript method with Python instead of relying on interpreter coverage.","Treat NotImplementedError from swfinterp as 'interpreter gap', not corruption — the message names the exact missing builtin."],"tags":["swf","avm2","string","not-implemented"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}