langchain-ai/deepagents · error · ToolRequirementIntrospectionError

uv tool receipt is missing `[tool].requirements`

Error message

uv tool receipt is missing `[tool].requirements`

What it means

The uv receipt was loaded, but its structure lacks the expected `[tool]` table with a `requirements` array, so no requirement entries can be iterated. The library treats such a receipt as invalid for introspection and raises ToolRequirementIntrospectionError.

Source

Thrown at libs/code/deepagents_code/update_check.py:2962

    in exactly one place. Callers apply their own per-entry key allowlist, which
    is the only part that legitimately differs between them.

    Args:
        data: Parsed `uv-receipt.toml` contents.

    Yields:
        Each requirement's declared `name` and its full table entry, in receipt
            order.

    Raises:
        ToolRequirementIntrospectionError: If `[tool].requirements` is missing or
            contains an entry that is not a table with a package name.
    """
    tool = data.get("tool")
    requirements = tool.get("requirements") if isinstance(tool, dict) else None
    if not isinstance(requirements, list):
        msg = "uv tool receipt is missing `[tool].requirements`"
        raise ToolRequirementIntrospectionError(msg)

    for entry in requirements:
        if not isinstance(entry, dict):
            msg = "uv tool receipt contains a non-table requirement entry"
            raise ToolRequirementIntrospectionError(msg)
        name = entry.get("name")
        if not isinstance(name, str) or not name:
            msg = "uv tool receipt contains a requirement without a package name"
            raise ToolRequirementIntrospectionError(msg)
        yield name, entry


def _uv_tool_python(
    tool_root: Path | None = None,
    *,
    data: dict[str, Any] | None = None,
) -> str | None:
    """Return the Python interpreter recorded in the uv tool receipt.

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Regenerate a correct receipt with `uv tool install deepagents-code --force`.
  2. If the receipt is from an older uv, upgrade uv (`uv self update` or reinstall) and reinstall the tool so the receipt matches the expected schema.
  3. Do not hand-edit the receipt's [tool] table; if you must inspect, confirm `tool.requirements` is a list of tables.

Example fix

// before: hand-written receipt missing requirements
 [tool]
 python = "3.12"
// after: expected structure
 [tool]
 python = "3.12"
 [[tool.requirements]]
 name = "deepagents-code"
Defensive patterns

Strategy: validation

Validate before calling

import tomllib
from pathlib import Path

def receipt_has_requirements(receipt: Path) -> bool:
    data = tomllib.loads(receipt.read_text(encoding='utf-8'))
    tool = data.get('tool')
    return isinstance(tool, dict) and isinstance(tool.get('requirements'), list)

Type guard

def is_valid_receipt(data: object) -> bool:
    tool = data.get('tool') if isinstance(data, dict) else None
    return isinstance(tool, dict) and isinstance(tool.get('requirements'), list)

Try / catch

try:
    extras = _uv_tool_selected_extras()
except ToolRequirementIntrospectionError:
    subprocess.run(['uv', 'tool', 'install', 'deepagents-code', '--force'], check=True)
    extras = _uv_tool_selected_extras()

Prevention

When it happens

Trigger: _iter_uv_tool_requirements receives a parsed receipt dict where data["tool"] is missing or not a dict, or data["tool"]["requirements"] is missing or not a list — typically called from _uv_tool_selected_extras or _uv_tool_with_packages.

Common situations: A receipt produced by a different uv version or format (schema drift); a user replaced the receipt with a minimal or hand-written file lacking [tool].requirements; an unrelated TOML file passed as tool_root's receipt.

Related errors


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