langchain-ai/deepagents · error · FleetImportError

{source}: {_display_path(path)}: {exc}

Error message

{source}: {_display_path(path)}: {exc}

What it means

The staged `tools.json` file could not be read from disk during import — an `OSError` (permission denied, missing file after staging, I/O error) occurred while `read_text`. The OS error text is included along with the source archive and display path.

Source

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

        paths.append((root, "root"))
    agents = staging / "agents"
    if agents.is_dir():
        for child in sorted(agents.iterdir(), key=lambda item: item.name):
            path = child / "tools.json"
            if path.is_file():
                paths.append((path, child.name))
    return paths


def _load_tool_requests(path: Path, scope: str, source: Path) -> list[_ToolRequest]:
    try:
        data = json.loads(path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as exc:
        msg = f"{source}: {_display_path(path)}: malformed tools.json: {exc.msg}"
        raise FleetImportError(msg) from exc
    except OSError as exc:
        msg = f"{source}: {_display_path(path)}: {exc}"
        raise FleetImportError(msg) from exc
    if not isinstance(data, dict):
        msg = f"{source}: {_display_path(path)}: malformed tools.json: expected object"
        raise FleetImportError(msg)

    raw_tools = data.get("tools")
    if not isinstance(raw_tools, list):
        msg = f"{source}: {_display_path(path)}: malformed tools.json: expected tools list"
        raise FleetImportError(msg)
    interrupt_config = data.get("interrupt_config")
    interrupts = interrupt_config if isinstance(interrupt_config, dict) else {}

    requests: list[_ToolRequest] = []
    for index, item in enumerate(raw_tools):
        if not isinstance(item, dict):
            msg = f"{source}: {_display_path(path)}: tools[{index}] must be an object"
            raise FleetImportError(msg)
        tool = cast("Mapping[str, object]", item)
        name = _required_str(tool, "name", path, index, source)

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Check permissions and existence of the staging temp file; re-run the import on a normal writable filesystem
  2. Close tools that lock temp files (AV/indexers) and exclude the import temp dir from scanning
  3. Ensure the source archive entry is a regular readable file (not an encrypted/unsupported compression method that decodes to nothing)
  4. Retry the import; a transient I/O error often clears on re-run

Example fix

// before: file locked/quarantined during read
// after: run import with standard permissions, AV exclusion on /tmp
chmod u+r tools.json && python -c "import fleet_import; fleet_import.import_fleet_zip(Path('fleet.zip'), target_dir=Path('agent'))"
Defensive patterns

Strategy: try-catch

Validate before calling

import json

try:
    json.loads(open("tools.json", encoding="utf-8").read())
except OSError as exc:
    raise SystemExit(f"tools.json unreadable: {exc}")

Try / catch

try:
    import_fleet_zip(zip_path, target_dir=target)
except FleetImportError as exc:
    if "tools.json" in str(exc) and "malformed" not in str(exc):
        print(f"Filesystem error reading tools.json: {exc}; check perms/locks and retry")
    raise

Prevention

When it happens

Trigger: `import_fleet_zip` → `_mcp_summaries` → `_load_tool_requests` raises `OSError` on `path.read_text(encoding="utf-8")`.

Common situations: Read-permission problems from restrictive umask/ACLs, the file vanished between validation and staging (concurrent process, antivirus quarantine), filesystem errors on the temp dir, or disk full.

Related errors


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