{"record":{"id":"0b2de466e2b594f6","repo":"langchain-ai/deepagents","slug":"could-not-read-uv-tool-receipt-at-receipt-path","errorCode":null,"errorMessage":"Could not read uv tool receipt at {receipt_path}: {exc}","messagePattern":"Could not read uv tool receipt at (.+?): (.+?)","errorType":"exception","errorClass":"ToolRequirementIntrospectionError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/update_check.py","lineNumber":2934,"sourceCode":"    Args:\n        tool_root: Optional uv tool environment root. Defaults to `sys.prefix`.\n\n    Returns:\n        Parsed TOML data from `uv-receipt.toml`.\n\n    Raises:\n        ToolRequirementIntrospectionError: If the receipt cannot be read or\n            parsed.\n    \"\"\"\n    receipt_path = _uv_tool_receipt_path(tool_root)\n    try:\n        return tomllib.loads(receipt_path.read_text(encoding=\"utf-8\"))\n    except FileNotFoundError as exc:\n        msg = f\"uv tool receipt not found at {receipt_path}\"\n        raise ToolRequirementIntrospectionError(msg) from exc\n    except (OSError, tomllib.TOMLDecodeError) as exc:\n        msg = f\"Could not read uv tool receipt at {receipt_path}: {exc}\"\n        raise ToolRequirementIntrospectionError(msg) from exc\n\n\ndef _iter_uv_tool_requirements(\n    data: dict[str, Any],\n) -> Iterator[tuple[str, dict[str, Any]]]:\n    \"\"\"Yield validated `(name, entry)` pairs from a uv tool receipt.\n\n    Shared by the selected-extras and `--with`-package readers so the receipt's\n    `[tool].requirements` shape is validated — and its failure messages worded —\n    in exactly one place. Callers apply their own per-entry key allowlist, which\n    is the only part that legitimately differs between them.\n\n    Args:\n        data: Parsed `uv-receipt.toml` contents.\n\n    Yields:\n        Each requirement's declared `name` and its full table entry, in receipt\n            order.","sourceCodeStart":2916,"sourceCodeEnd":2952,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/update_check.py#L2916-L2952","documentation":"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.","triggerScenarios":"_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.","commonSituations":"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.","solutions":["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'))\"`).","Fix permissions: `chmod u+r uv-receipt.toml` or chown to the user running the tool.","If corrupt or unreadable, reinstall: `uv tool install deepagents-code --force` to regenerate a clean receipt."],"exampleFix":"// before: hand-edited, broken receipt\n [tool]\n requirements = [  # missing closing bracket\n// after: regenerate instead of editing\n $ uv tool install deepagents-code --force  # rewrites a valid uv-receipt.toml","handlingStrategy":"try-catch","validationCode":"import tomllib\nfrom pathlib import Path\n\ndef receipt_parses(receipt: Path) -> bool:\n    try:\n        tomllib.loads(receipt.read_text(encoding='utf-8'))\n        return True\n    except (OSError, tomllib.TOMLDecodeError):\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    cmd = _uv_tool_install_command()\nexcept ToolRequirementIntrospectionError as exc:\n    log.warning('unreadable uv receipt, reinstalling: %s', exc)\n    subprocess.run(['uv', 'tool', 'install', 'deepagents-code', '--force'], check=True)\n    cmd = _uv_tool_install_command()","preventionTips":["Never hand-edit uv-receipt.toml; let uv write it.","Ensure the user running the tool owns the uv tool directory (no root/other-user installs mixed).","Validate receipts after copying tool dirs between machines.","Watch disk space during `uv tool upgrade` — partial writes corrupt TOML."],"tags":["uv","toml","file-corruption","permissions"],"backgroundTag":"toml-parse-error","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}