langchain-ai/deepagents · error · ToolRequirementIntrospectionError

uv tool receipt requirement {name!r} uses source fields that

Error message

uv tool receipt requirement {name!r} uses source fields that cannot be preserved automatically: {fields}

What it means

The deepagents-code requirement entry in the receipt uses source fields (unsupported keys such as path, git, url, editable) that the library cannot round-trip when rebuilding the `uv tool install` command. Because reconstructed installs would silently lose the custom source, the library refuses and raises ToolRequirementIntrospectionError listing the offending fields.

Source

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

    if data is None:
        data = _uv_tool_receipt_data(tool_root)

    main = canonicalize_name(distribution_name)
    for name, entry in _iter_uv_tool_requirements(data):
        if canonicalize_name(name) != main:
            continue
        unsupported_keys = sorted(
            str(key)
            for key in entry
            if not isinstance(key, str) or key not in {"name", "extras", "specifier"}
        )
        if unsupported_keys:
            fields = ", ".join(unsupported_keys)
            msg = (
                f"uv tool receipt requirement {name!r} uses source fields "
                f"that cannot be preserved automatically: {fields}"
            )
            raise ToolRequirementIntrospectionError(msg)
        extras = entry.get("extras", [])
        if not isinstance(extras, list) or any(
            not isinstance(extra, str) or not is_valid_extra_name(extra)
            for extra in extras
        ):
            msg = "uv tool receipt contains invalid extras on the tool requirement"
            raise ToolRequirementIntrospectionError(msg)
        normalized = {canonicalize_name(extra) for extra in extras}
        if len(normalized) != len(extras):
            msg = "uv tool receipt contains duplicate canonical extra names"
            raise ToolRequirementIntrospectionError(msg)
        return normalized

    msg = f"uv tool receipt does not contain a {distribution_name!r} requirement"
    raise ToolRequirementIntrospectionError(msg)


def _uv_tool_with_packages(

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Reinstall from the registry: `uv tool install deepagents-code --force` so the receipt has no source fields.
  2. If a custom source is required, manage extras/updates manually with an explicit `uv tool install --from <source> deepagents-code ...` command instead of the library's introspection helpers.
  3. Identify the listed unsupported fields in the receipt entry and decide whether to keep them out of automated refresh flows.

Example fix

// before: receipt entry from a path install
 [[tool.requirements]]
 name = "deepagents-code"
 path = "/home/me/src/deepagents"
 editable = true
// after: registry install the library can reconstruct
 [[tool.requirements]]
 name = "deepagents-code"
Defensive patterns

Strategy: try-catch

Validate before calling

import tomllib

UNSUPPORTED_SOURCE_FIELDS = {'path', 'git', 'url', 'editable', 'subdirectory', 'tag', 'branch', 'rev'}

def has_unsupported_source(data: dict, dist: str = 'deepagents-code') -> bool:
    for entry in (data.get('tool') or {}).get('requirements', []):
        if isinstance(entry, dict) and entry.get('name') == dist:
            return bool(UNSUPPORTED_SOURCE_FIELDS & entry.keys())
    return False

Try / catch

try:
    cmd = _uv_tool_install_command()
except ToolRequirementIntrospectionError:
    # dev/path/git install: reconstruct manually with --from
    cmd = ['uv', 'tool', 'install', '--force', '--from', source, 'deepagents-code']

Prevention

When it happens

Trigger: _uv_tool_selected_extras (called by _uv_tool_install_command, dependency_refresh_dry_run_command, removable_extras, or uninstall_extra_command) inspects the deepagents-code requirement entry and finds unsupported source keys present.

Common situations: deepagents-code installed from a local path or git URL (`uv tool install --from`/`--editable`/git) so the receipt records non-registry source fields; a CI caches such an install and later tries dependency refresh or extras management.

Related errors


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