{"record":{"id":"978c2430f05eeca9","repo":"langchain-ai/deepagents","slug":"uv-tool-receipt-contains-an-invalid-tool-python","errorCode":null,"errorMessage":"uv tool receipt contains an invalid `[tool].python` value","messagePattern":"uv tool receipt contains an invalid `\\[tool\\]\\.python` value","errorType":"exception","errorClass":"ToolRequirementIntrospectionError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/update_check.py","lineNumber":3007,"sourceCode":"        The recorded `[tool].python` value, or `None` when the receipt does not\n            pin an interpreter.\n\n    Raises:\n        ToolRequirementIntrospectionError: If the receipt cannot be read, parsed,\n            or safely re-expressed as a `--python` value.\n    \"\"\"\n    if data is None:\n        data = _uv_tool_receipt_data(tool_root)\n    tool = data.get(\"tool\")\n    if not isinstance(tool, dict):\n        msg = \"uv tool receipt is missing `[tool]`\"\n        raise ToolRequirementIntrospectionError(msg)\n    python = tool.get(\"python\")\n    if python is None:\n        return None\n    if not isinstance(python, str) or not python:\n        msg = \"uv tool receipt contains an invalid `[tool].python` value\"\n        raise ToolRequirementIntrospectionError(msg)\n    return python\n\n\ndef _uv_tool_selected_extras(\n    *,\n    distribution_name: str = \"deepagents-code\",\n    tool_root: Path | None = None,\n    data: dict[str, Any] | None = None,\n) -> set[NormalizedName]:\n    \"\"\"Return extras explicitly selected on the uv tool requirement.\n\n    Args:\n        distribution_name: Main tool distribution whose extras to read.\n        tool_root: Optional uv tool environment root. Defaults to `sys.prefix`.\n        data: Optional pre-parsed receipt contents. Supplied by callers that\n            read several receipt fields at once so the file is parsed once\n            rather than per field.\n","sourceCodeStart":2989,"sourceCodeEnd":3025,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/update_check.py#L2989-L3025","documentation":"The `[tool].python` key exists in the receipt but is not a usable version string (empty or non-string). _uv_tool_python returns None when the key is absent (allowed), but raises when it is present yet invalid.","triggerScenarios":"_uv_tool_python reads tool.get(\"python\") and finds a non-string truthy-but-invalid value (e.g. inline table, number, empty string), reached via _uv_tool_install_command.","commonSituations":"Receipt hand-edited with `python = 3.12` (number, not string) or `python = \"\"`; a receipt produced by tooling that wrote the wrong type; corruption during editing.","solutions":["Set `python` to a quoted version string: `python = \"3.12\"`.","Regenerate the receipt with `uv tool install deepagents-code --force --python 3.12`.","If you don't need a pinned python, remove the key entirely rather than leaving it empty."],"exampleFix":"// before\n [tool]\n python = 3.12\n// after\n [tool]\n python = \"3.12\"","handlingStrategy":"validation","validationCode":"import tomllib\n\ndef python_value_ok(data: dict) -> bool:\n    tool = data.get('tool') or {}\n    py = tool.get('python')\n    return py is None or (isinstance(py, str) and bool(py))","typeGuard":"def is_valid_python_pin(value: object) -> bool:\n    return isinstance(value, str) and bool(value)","tryCatchPattern":"try:\n    python = _uv_tool_python()\nexcept ToolRequirementIntrospectionError:\n    python = None  # ignore bad pin, use default","preventionTips":["Quote python pins in TOML: `python = \"3.12\"`, never a bare number.","Omit [tool].python entirely rather than writing an empty string.","Regenerate with `uv tool install deepagents-code --force --python 3.12`.","Lint receipt TOML types after programmatic generation."],"tags":["uv","receipt-schema","type-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}