langchain-ai/deepagents · error · ToolRequirementIntrospectionError

Could not read uv tool receipt at {receipt_path}: {exc}

Error message

Could not read uv tool receipt at {receipt_path}: {exc}

What it means

The uv tool receipt file exists but cannot be read or parsed: an OSError (permissions, I/O failure) or a TOMLDecodeError (malformed TOML) occurred while loading uv-receipt.toml. The library raises ToolRequirementIntrospectionError with the underlying exception embedded so the developer can diagnose the environment or file corruption.

Source

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

    Args:
        tool_root: Optional uv tool environment root. Defaults to `sys.prefix`.

    Returns:
        Parsed TOML data from `uv-receipt.toml`.

    Raises:
        ToolRequirementIntrospectionError: If the receipt cannot be read or
            parsed.
    """
    receipt_path = _uv_tool_receipt_path(tool_root)
    try:
        return tomllib.loads(receipt_path.read_text(encoding="utf-8"))
    except FileNotFoundError as exc:
        msg = f"uv tool receipt not found at {receipt_path}"
        raise ToolRequirementIntrospectionError(msg) from exc
    except (OSError, tomllib.TOMLDecodeError) as exc:
        msg = f"Could not read uv tool receipt at {receipt_path}: {exc}"
        raise ToolRequirementIntrospectionError(msg) from exc


def _iter_uv_tool_requirements(
    data: dict[str, Any],
) -> Iterator[tuple[str, dict[str, Any]]]:
    """Yield validated `(name, entry)` pairs from a uv tool receipt.

    Shared by the selected-extras and `--with`-package readers so the receipt's
    `[tool].requirements` shape is validated — and its failure messages worded —
    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.

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Inspect the file at `$(uv tool dir)/deepagents-code/uv-receipt.toml`; validate it parses (e.g. `python -c "import tomllib; tomllib.load(open(p,'rb'))"`).
  2. Fix permissions: `chmod u+r uv-receipt.toml` or chown to the user running the tool.
  3. If corrupt or unreadable, reinstall: `uv tool install deepagents-code --force` to regenerate a clean receipt.

Example fix

// before: hand-edited, broken receipt
 [tool]
 requirements = [  # missing closing bracket
// after: regenerate instead of editing
 $ uv tool install deepagents-code --force  # rewrites a valid uv-receipt.toml
Defensive patterns

Strategy: try-catch

Validate before calling

import tomllib
from pathlib import Path

def receipt_parses(receipt: Path) -> bool:
    try:
        tomllib.loads(receipt.read_text(encoding='utf-8'))
        return True
    except (OSError, tomllib.TOMLDecodeError):
        return False

Try / catch

try:
    cmd = _uv_tool_install_command()
except ToolRequirementIntrospectionError as exc:
    log.warning('unreadable uv receipt, reinstalling: %s', exc)
    subprocess.run(['uv', 'tool', 'install', 'deepagents-code', '--force'], check=True)
    cmd = _uv_tool_install_command()

Prevention

When it happens

Trigger: _uv_tool_receipt_data reads the receipt via tomllib.loads(receipt_path.read_text(...)) and the read raises OSError (e.g. permission denied, disk error) or tomllib raises TOMLDecodeError on syntactically invalid TOML.

Common situations: Receipt file corrupted by a crashed uv install or manual editing; read permissions lost after copying the tool dir as another user; symlink to a missing/unreadable target; truncated file after disk-full during upgrade.

Related errors


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