langchain-ai/deepagents · error · FleetImportError
{source}: invalid zip file
Error message
{source}: invalid zip file What it means
FleetImportError raised by `import_fleet_zip` when the source file cannot be opened as a zip archive. `zipfile.ZipFile(source)` raises BadZipFile, which is caught and re-raised as `FleetImportError(f"{source}: invalid zip file")` with the original exception chained. This is a fail-fast replacement for the stdlib exception.
Source
Thrown at libs/talon/deepagents_talon/fleet_import.py:158
target = target_dir.expanduser()
home = assistant_home.expanduser() if assistant_home is not None else target
try:
with zipfile.ZipFile(source) as archive:
entries = _validated_entries(archive)
if "AGENTS.md" not in entries:
msg = "AGENTS.md: missing required root prompt"
raise FleetImportError(msg)
with tempfile.TemporaryDirectory(prefix="deepagents-talon-import-") as raw:
staging = Path(raw)
_materialize_staging(archive, entries, staging)
summaries = _mcp_summaries(staging, source)
notes = _format_setup_notes(source.name, summaries)
mcp_config = _format_mcp_config(summaries)
config_ignored = (staging / "config.json").is_file()
_refresh_target(staging, target, home, notes, mcp_config)
except zipfile.BadZipFile as exc:
msg = f"{source}: invalid zip file"
raise FleetImportError(msg) from exc
except OSError as exc:
msg = f"{target}: {exc}"
raise FleetImportError(msg) from exc
return FleetImportResult(
target_dir=target,
root_prompt_count=1,
subagent_prompt_count=len(_subagent_prompt_paths(home)),
config_ignored=config_ignored,
mcp_notes=notes,
interrupt_tools=tuple(
sorted({tool for summary in summaries for tool in summary.interrupt_tools})
),
)
def format_import_stdout(result: FleetImportResult) -> str:
"""Render a concise user-facing import summary.View on GitHub (pinned to a1af029e6e)
Solutions
- Verify the file is a valid zip: `python -m zipfile -t fleet.zip` or `unzip -t fleet.zip`.
- Re-export or re-download the archive; ensure it is a real zip, not tar.gz.
- Check the file is non-empty and not an HTML error page saved by a failed download (`file fleet.zip`).
Example fix
// before
import_fleet_zip(Path("fleet.tar.gz"), target)
// after (convert first)
subprocess.run(["tar", "-xzf", "fleet.tar.gz"]);
subprocess.run(["zip", "-r", "fleet.zip", "."], cwd="extracted")
import_fleet_zip(Path("fleet.zip"), target) Defensive patterns
Strategy: validation
Validate before calling
import zipfile
def is_valid_zip(path) -> bool:
try:
with zipfile.ZipFile(path) as z:
return z.testzip() is None
except (zipfile.BadZipFile, OSError):
return False Try / catch
from deepagents_talon.fleet_import import import_fleet_zip, FleetImportError
try:
result = import_fleet_zip(source, target)
except FleetImportError as exc:
if "invalid zip file" in str(exc):
raise SystemExit(f"re-download or re-export {source}; it is not a valid zip") from exc
raise Prevention
- Verify downloads (checksum/size) before importing.
- Do not rename tar.gz to zip; convert or re-export as real zip.
- Use `unzip -t` or `python -m zipfile -t` as a pre-import sanity check.
When it happens
Trigger: Passing a path that is not a zip (plain text, tar.gz, truncated download, empty file) to `import_fleet_zip`. The `zipfile.BadZipFile` handler at libs/talon/deepagents_talon/fleet_import.py:157 converts it.
Common situations: Download interrupted leaving a truncated/corrupt archive; renaming a .tar.gz to .zip; pointing at a directory or text file by mistake; zip produced with an unsupported legacy format.
Related errors
- AGENTS.md: missing required root prompt
- Invalid class_path '{class_path}' for provider '{provider}':
- Could not import module '{module_path}' for provider '{provi
- Class '{class_name}' not found in module '{module_path}' for
- Provider package '{package}' is installed but failed to impo
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/92eae473335de5f8.
Report an issue: GitHub.