home-assistant/core · error · HomeAssistantError
wrong_file_path
Error message
wrong_file_path
What it means
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.
Source
Thrown at homeassistant/components/anthropic/entity.py:1268
if not chat_log.unresponded_tool_results:
coordinator.async_set_updated_data(coordinator.data)
break
async def async_prepare_files_for_prompt(
hass: HomeAssistant, model_info: ModelInfo, files: list[tuple[Path, str | None]]
) -> Iterable[ImageBlockParam | DocumentBlockParam]:
"""Append files to a prompt.
Caller needs to ensure that the files are allowed.
"""
def append_files_to_content() -> Iterable[ImageBlockParam | DocumentBlockParam]:
content: list[ImageBlockParam | DocumentBlockParam] = []
for file_path, mime_type in files:
if not file_path.exists():
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="wrong_file_path",
translation_placeholders={"file_path": file_path.as_posix()},
)
if mime_type is None:
mime_type = guess_file_type(file_path)[0]
if (
not mime_type
or not mime_type.startswith(("image/", "application/pdf"))
or not model_info.capabilities
or (
mime_type.startswith("image/")
and not model_info.capabilities.image_input.supported
)
or (
mime_type.startswith("application/pdf")View on GitHub (pinned to 58a3fdb3ea)
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
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def all_files_exist(files: list[tuple[Path, str | None]]) -> bool:
return all(path.exists() for path, _ in files) Try / catch
for file_path, mime_type in files:
if not file_path.exists():
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="wrong_file_path",
translation_placeholders={"file_path": file_path.as_posix()},
) Prevention
- Attach files immediately before the LLM call, not long before
- Avoid referencing temp files subject to cleanup in long-lived conversations
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- user_message_not_found
- wrong_file_type
- System generated users cannot disable multi-factor auth modu
- response_not_found
- json_parse_error
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/1a8c871ce711d39f.
Report an issue: GitHub.