home-assistant/core · error · HomeAssistantError
AI Task entity {entity_id} not found
Error message
AI Task entity {entity_id} not found What it means
HomeAssistantError from ai_task.async_generate_data when hass.data[DATA_COMPONENT].get_entity(entity_id) returns None — the requested (or preferred) entity id does not match any entity registered by the AI Task component's entity platform. The lookup happens after the entity_id fallback resolution, so both explicit and stored ids can trigger it.
Source
Thrown at homeassistant/components/ai_task/task.py:132
hass: HomeAssistant,
*,
task_name: str,
entity_id: str | None = None,
instructions: str,
structure: vol.Schema | None = None,
attachments: list[dict] | None = None,
llm_api: llm.API | None = None,
) -> GenDataTaskResult:
"""Run a data generation task in the AI Task integration."""
if entity_id is None:
entity_id = hass.data[DATA_PREFERENCES].gen_data_entity_id
if entity_id is None:
raise HomeAssistantError("No entity_id provided and no preferred entity set")
entity = hass.data[DATA_COMPONENT].get_entity(entity_id)
if entity is None:
raise HomeAssistantError(f"AI Task entity {entity_id} not found")
if AITaskEntityFeature.GENERATE_DATA not in entity.supported_features:
raise HomeAssistantError(
f"AI Task entity {entity_id} does not support generating data"
)
if (
attachments
and AITaskEntityFeature.SUPPORT_ATTACHMENTS not in entity.supported_features
):
raise HomeAssistantError(
f"AI Task entity {entity_id} does not support attachments"
)
with async_get_chat_session(hass) as session:
resolved_attachments = await _resolve_attachments(hass, session, attachments)
return await entity.internal_async_generate_data(View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Check the exact id in Developer Tools > States and use an entity that appears under the ai_task-capable conversation/agent entities.
- If the preferred entity is stale, re-set the default via the generate_data UI dialog or pass entity_id explicitly.
- Reload the relevant conversation integration so its entities register, then retry.
- In automations, guard with a condition like '{{ states(entity_id) not in ["unknown","unavailable"] }}' or an entity existence check.
Defensive patterns
Strategy: validation
Validate before calling
def entity_registered(hass, entity_id: str) -> bool:
"""The ai_task component knows this entity id."""
component = hass.data.get(DATA_COMPONENT)
return component is not None and component.get_entity(entity_id) is not None Try / catch
from homeassistant.exceptions import HomeAssistantError
try:
result = await async_generate_data(hass, entity_id=eid, task_name="t", instructions="...")
except HomeAssistantError as err:
_LOGGER.warning("AI Task target invalid: %s", err) # check id in Developer Tools Prevention
- Verify entity ids in Developer Tools > States before scripting them.
- Refresh the stored default after renaming/removing agent entities.
- Prefer stable entity_id (set unique_id-backed ids) over generated names.
When it happens
Trigger: Passing entity_id of an entity that is not an ai_task-capable entity (wrong domain, typo, or a conversation entity that is not exposed as an AI Task entity), or the preferred entity having been removed/renamed since it was saved.
Common situations: Automation references a stale entity after the LLM integration was removed or its entity_id changed; user passes a climate/switch entity by mistake; the conversation entity exists but was not registered into the ai_task entity component yet (platform not loaded).
Related errors
- No entity_id provided and no preferred entity set
- AI Task entity {entity_id} does not support generating data
- Heat/Cool is not supported in this mode
- AI Task media source requires at least one media directory c
- Only local attachments are currently supported
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/2f129d60be1072d1.
Report an issue: GitHub.