{"record":{"id":"2b3c3864ca151dbc","repo":"ytdl-org/youtube-dl","slug":"invalid-path","errorCode":null,"errorMessage":"Invalid path","messagePattern":"Invalid path","errorType":"http","errorClass":"BuildError","httpStatus":500,"severity":"error","filePath":"devscripts/buildserver.py","lineNumber":300,"sourceCode":"                break\n            except Exception:\n                pass\n\n        if not python_path:\n            raise BuildError('No such Python version: %s' % python_version)\n\n        self.pythonPath = python_path\n\n        super(PythonBuilder, self).__init__(**kwargs)\n\n\nclass GITInfoBuilder(object):\n    def __init__(self, **kwargs):\n        try:\n            self.user, self.repoName = kwargs['path'][:2]\n            self.rev = kwargs.pop('rev')\n        except ValueError:\n            raise BuildError('Invalid path')\n        except KeyError as e:\n            raise BuildError('Missing mandatory parameter \"%s\"' % e.args[0])\n\n        path = os.path.join(os.environ['APPDATA'], 'Build archive', self.repoName, self.user)\n        if not os.path.exists(path):\n            os.makedirs(path)\n        self.basePath = tempfile.mkdtemp(dir=path)\n        self.buildPath = os.path.join(self.basePath, 'build')\n\n        super(GITInfoBuilder, self).__init__(**kwargs)\n\n\nclass GITBuilder(GITInfoBuilder):\n    def build(self):\n        try:\n            subprocess.check_output(['git', 'clone', 'git://github.com/%s/%s.git' % (self.user, self.repoName), self.buildPath])\n            subprocess.check_output(['git', 'checkout', self.rev], cwd=self.buildPath)\n        except subprocess.CalledProcessError as e:","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/devscripts/buildserver.py#L282-L318","documentation":"Thrown by youtube-dl's SWF bytecode interpreter when the bytes passed to _extract_tags do not start with a valid SWF signature. A real SWF file begins with 'FWS' (uncompressed), 'CWS' (zlib-compressed), or 'ZWS' (LZMA); this code checks bytes 1-3 for 'WS'. Getting an ExtractorError here means the downloaded payload was HTML/JSON (often an error page) rather than the expected SWF file.","triggerScenarios":"An extractor calls SWFInterpreter on content fetched from a hard-coded SWF URL (used to decipher signatures or compute keys, e.g. for signed CDN URLs). The check triggers when bytes 1:3 != b'WS': the server returned a 200 HTML page, a redirect body, a CAPTCHA/login wall, or the file format changed. Direct API use of swfinterp._extract_tags / SWFInterpreter with non-SWF bytes also triggers it.","commonSituations":"A site changed its player SWF location or stopped serving SWF players entirely (moved to HTML5/JS); a geo-block or CDN error page is served instead of the SWF; an outdated youtube-dl with stale SWF URLs; passing a local file that is not Flash.","solutions":["Update youtube-dl (youtube-dl -U) or switch to yt-dlp — SWF URL and deciphering logic rot quickly and are fixed in releases.","Fetch the SWF URL manually (curl) and inspect the first bytes: if it is HTML, the site no longer serves that player; find the new player URL from the page source.","If you call swfinterp yourself, validate the payload starts with b'FWS'/b'CWS'/b'ZWS' before interpreting.","As an extractor maintainer, refresh the SWF URL extraction so it is read from the watch page rather than hard-coded."],"exampleFix":"# before\ninterpreter = SWFInterpreter(swf_bytes)  # may raise on non-SWF payload\n\n# after\nif swf_bytes[1:3] != b'WS':\n    raise ExtractorError('Expected SWF player, got %r' % swf_bytes[:20])\ninterpreter = SWFInterpreter(swf_bytes)","handlingStrategy":"validation","validationCode":"def is_swf(data):\n    return len(data) >= 3 and data[:3] in (b'FWS', b'CWS', b'ZWS')\n\n# before interpreting:\n# assert is_swf(swf_bytes), 'server did not return an SWF'","typeGuard":"def is_swf(data: bytes) -> bool:\n    return len(data) >= 3 and data[1:3] == b'WS' and data[0:1] in (b'F', b'C', b'Z')","tryCatchPattern":"from youtube_dl.utils import ExtractorError\nfrom youtube_dl.swfinterp import SWFInterpreter\ntry:\n    interp = SWFInterpreter(swf_bytes)\nexcept ExtractorError as e:\n    if 'Not an SWF file' in str(e):\n        raise ExtractorError('Player URL returned non-SWF content (site changed?) — update youtube-dl')\n    raise","preventionTips":["Validate the SWF signature (FWS/CWS/ZWS) before calling SWFInterpreter.","Log the first bytes of downloaded 'SWF' payloads in debug builds to catch HTML error pages early.","Pin player-SWF URLs by extracting them from the watch page, not hard-coding them."],"tags":["swf","flash","extractor","format-validation"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}