ytdl-org/youtube-dl · error · BuildError

Missing mandatory parameter "%s"

Error message

Missing mandatory parameter "%s"

What it means

Raised by swfinterp._extract_tags when the SWF file's compression signature (first byte) is not 'C' (CWS, zlib-compressed). youtube-dl's interpreter only implements zlib-compressed SWFs; uncompressed 'FWS' and LZMA-compressed 'ZWS' files hit this NotImplementedError. It indicates the interpreter received a valid SWF whose compression variant it cannot decode.

Source

Thrown at devscripts/buildserver.py:302

                pass

        if not python_path:
            raise BuildError('No such Python version: %s' % python_version)

        self.pythonPath = python_path

        super(PythonBuilder, self).__init__(**kwargs)


class GITInfoBuilder(object):
    def __init__(self, **kwargs):
        try:
            self.user, self.repoName = kwargs['path'][:2]
            self.rev = kwargs.pop('rev')
        except ValueError:
            raise BuildError('Invalid path')
        except KeyError as e:
            raise BuildError('Missing mandatory parameter "%s"' % e.args[0])

        path = os.path.join(os.environ['APPDATA'], 'Build archive', self.repoName, self.user)
        if not os.path.exists(path):
            os.makedirs(path)
        self.basePath = tempfile.mkdtemp(dir=path)
        self.buildPath = os.path.join(self.basePath, 'build')

        super(GITInfoBuilder, self).__init__(**kwargs)


class GITBuilder(GITInfoBuilder):
    def build(self):
        try:
            subprocess.check_output(['git', 'clone', 'git://github.com/%s/%s.git' % (self.user, self.repoName), self.buildPath])
            subprocess.check_output(['git', 'checkout', self.rev], cwd=self.buildPath)
        except subprocess.CalledProcessError as e:
            raise BuildError(e.output)

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Pre-compress the payload before handing it to the interpreter: read the real header, then zlib.compress the body and rewrite the signature to 'CWS' (only viable if you control the input).
  2. For FWS files, you can wrap them: decompress nothing, but easiest is to recompress the whole file and patch bytes 0-2 to b'CWS' plus the original uncompressed length.
  3. Update to yt-dlp, which dropped SWF interpretation in favor of ported JS deciphering for the sites that still need it.
  4. If you maintain an extractor, prefer reimplementing the player's signing algorithm in Python instead of interpreting the SWF.

Example fix

# before
interp = SWFInterpreter(swf_bytes)  # raises for b'FWS'/b'ZWS'

# after: normalize an uncompressed FWS to CWS so swfinterp accepts it
import struct, zlib
if swf_bytes[:1] == b'F':
    body = swf_bytes[8:]
    compressed = zlib.compress(body)
    header = b'CWS' + swf_bytes[3:8] + compressed
    swf_bytes = header
interp = SWFInterpreter(swf_bytes)
Defensive patterns

Strategy: fallback

Validate before calling

import zlib

def normalize_to_cws(data):
    """Return a CWS (zlib) payload swfinterp accepts, or None if impossible."""
    if data[:3] == b'CWS':
        return data
    if data[:3] == b'FWS':
        return b'CWS' + data[3:8] + zlib.compress(data[8:])
    return None  # ZWS (LZMA) unsupported by this swfinterp

Type guard

def swf_is_zlib_compressed(data: bytes) -> bool:
    return data[:3] == b'CWS'

Try / catch

try:
    tags = _extract_tags(swf_bytes)
except NotImplementedError as e:  # 'Unsupported compression format'
    normalized = normalize_to_cws(swf_bytes)
    if normalized is None:
        raise ExtractorError('LZMA SWF not supported; decompress externally')
    tags = _extract_tags(normalized)

Prevention

When it happens

Trigger: Passing an uncompressed SWF (starts with b'FWS') or an LZMA-compressed SWF (starts with b'ZWS', Flash 13+) to SWFInterpreter / _extract_tags. Common when a site ships an uncompressed player SWF or a newer LZMA-compressed one and youtube-dl downloads it for signature deciphering.

Common situations: Site updates its player to a newer Flash toolchain producing ZWS files; developer feeds a locally-saved uncompressed SWF; partial download that corrupts the header also misroutes here.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/5abbf99ad5441310. Report an issue: GitHub.