langchain-ai/deepagents · error · FleetImportError

{name}: zip entry compression ratio exceeds limit

Error message

{name}: zip entry compression ratio exceeds limit

What it means

A zip entry's declared uncompressed size exceeds its compressed size by more than `_MAX_ZIP_COMPRESSION_RATIO` (100x). This heuristic flags classic zip bombs — highly compressible payloads designed to explode during extraction — even when each entry is under the absolute size cap.

Source

Thrown at libs/talon/deepagents_talon/fleet_import.py:265

        or windows.drive != ""
        or any(part in {"", ".", ".."} for part in posix.parts)
    )


def _is_symlink(info: zipfile.ZipInfo) -> bool:
    file_type = (info.external_attr >> 16) & _ZIP_FILE_TYPE_MASK
    return file_type == _ZIP_SYMLINK_TYPE


def _validate_zip_entry_size(name: str, info: zipfile.ZipInfo) -> None:
    if info.file_size > _MAX_ZIP_UNCOMPRESSED_BYTES:
        msg = f"{name}: zip entry uncompressed size exceeds limit"
        raise FleetImportError(msg)
    if info.compress_size == 0:
        return
    if info.file_size > info.compress_size * _MAX_ZIP_COMPRESSION_RATIO:
        msg = f"{name}: zip entry compression ratio exceeds limit"
        raise FleetImportError(msg)


def _materialize_staging(
    archive: zipfile.ZipFile,
    entries: Mapping[str, zipfile.ZipInfo],
    staging: Path,
) -> None:
    _copy_zip_file(archive, entries["AGENTS.md"], staging / "AGENTS.md")

    for name, info in entries.items():
        if name.startswith("skills/"):
            _copy_zip_file(archive, info, staging / name)
        elif _is_subagent_prompt_path(name):
            subagent = PurePosixPath(name).parts[1]
            _validate_agent_name(subagent, name)
            _copy_zip_file(archive, info, staging / "agents" / subagent / "AGENTS.md")
        elif name in {"config.json", "tools.json"}:
            _copy_zip_file(archive, info, staging / name)

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Inspect the entry's compress/file size ratio; if it is legitimate data (e.g. zeros, repeated text), store it uncompressed (`zip -0`) or split it
  2. Rebuild the export excluding the offending file; keep normal assets in the archive
  3. Verify archive integrity (`zipfile.ZipFile(p).testzip()`) to rule out corruption
  4. If you truly need to import such data, do it outside `import_fleet_zip` via direct file placement

Example fix

# before: 300 MB of zeros compressing to ~300 KB (ratio 1000x)
# after: ship pre-compressed asset uncompressed in zip
zip -0 fleet.zip skills/dump/zeros.bin  # or exclude the file
Defensive patterns

Strategy: validation

Validate before calling

import zipfile

RATIO = 100

def has_suspicious_ratio(path):
    with zipfile.ZipFile(path) as z:
        for zi in z.infolist():
            if zi.compress_size and zi.file_size > zi.compress_size * RATIO:
                return True
    return False

Try / catch

try:
    import_fleet_zip(zip_path, target_dir=target)
except FleetImportError as exc:
    if "compression ratio exceeds limit" in str(exc):
        print("Archive looks like a zip bomb; verify or store the entry uncompressed")
    raise

Prevention

When it happens

Trigger: `import_fleet_zip` sees an entry with `info.file_size > info.compress_size * 100` (entries with `compress_size == 0` skip this check).

Common situations: Hand-crafted zip bombs, archives containing long runs of zeros (sparse backups, dumps) that legitimately compress >100x, or corrupted headers declaring inflated sizes.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/35c843a977ceb6c9. Report an issue: GitHub.