{"record":{"id":"1a8c871ce711d39f","repo":"home-assistant/core","slug":"wrong-file-path","errorCode":null,"errorMessage":"wrong_file_path","messagePattern":"wrong_file_path","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/anthropic/entity.py","lineNumber":1268,"sourceCode":"            if not chat_log.unresponded_tool_results:\n                coordinator.async_set_updated_data(coordinator.data)\n                break\n\n\nasync def async_prepare_files_for_prompt(\n    hass: HomeAssistant, model_info: ModelInfo, files: list[tuple[Path, str | None]]\n) -> Iterable[ImageBlockParam | DocumentBlockParam]:\n    \"\"\"Append files to a prompt.\n\n    Caller needs to ensure that the files are allowed.\n    \"\"\"\n\n    def append_files_to_content() -> Iterable[ImageBlockParam | DocumentBlockParam]:\n        content: list[ImageBlockParam | DocumentBlockParam] = []\n\n        for file_path, mime_type in files:\n            if not file_path.exists():\n                raise HomeAssistantError(\n                    translation_domain=DOMAIN,\n                    translation_key=\"wrong_file_path\",\n                    translation_placeholders={\"file_path\": file_path.as_posix()},\n                )\n\n            if mime_type is None:\n                mime_type = guess_file_type(file_path)[0]\n\n            if (\n                not mime_type\n                or not mime_type.startswith((\"image/\", \"application/pdf\"))\n                or not model_info.capabilities\n                or (\n                    mime_type.startswith(\"image/\")\n                    and not model_info.capabilities.image_input.supported\n                )\n                or (\n                    mime_type.startswith(\"application/pdf\")","sourceCodeStart":1250,"sourceCodeEnd":1286,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/anthropic/entity.py#L1250-L1286","documentation":"A HomeAssistantError with translation key 'wrong_file_path' raised in async_prepare_files_for_prompt when an attachment's file_path does not exist on disk. The placeholder 'file_path' shows the POSIX path that was checked with Path.exists(). Files are validated before being base64-encoded into the prompt.","triggerScenarios":"Passing an (a.path, a.mime_type) pair to async_prepare_files_for_prompt where a.path points to a deleted or moved file — e.g. an attachment referencing temporary assistant data cleaned up between enqueue and processing, or a manually constructed path.","commonSituations":"Temporary snapshot/image files in .storage or config dir removed by retention cleanup before the LLM call ran; path typos; files on an unmounted network share.","solutions":["Confirm the file exists at the exact path shown in the 'file_path' placeholder on the Home Assistant host","Re-attach or regenerate the file (re-run the automation that produced it) before retrying","If files live on external storage, verify the mount is present when the conversation runs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef all_files_exist(files: list[tuple[Path, str | None]]) -> bool:\n    return all(path.exists() for path, _ in files)","typeGuard":null,"tryCatchPattern":"for file_path, mime_type in files:\n    if not file_path.exists():\n        raise HomeAssistantError(\n            translation_domain=DOMAIN,\n            translation_key=\"wrong_file_path\",\n            translation_placeholders={\"file_path\": file_path.as_posix()},\n        )","preventionTips":["Attach files immediately before the LLM call, not long before","Avoid referencing temp files subject to cleanup in long-lived conversations"],"tags":["home-assistant","anthropic","attachments","file-not-found"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}