home-assistant/core · error · HomeAssistantError

AI Task entity {entity_id} does not support attachments

Error message

AI Task entity {entity_id} does not support attachments

What it means

HomeAssistantError from ai_task.async_generate_data when attachments were supplied but the entity's supported_features lacks AITaskEntityFeature.SUPPORT_ATTACHMENTS. The guard runs after existence and GENERATE_DATA checks, immediately before resolving attachments in the chat session — an entity that cannot ingest files would otherwise silently ignore them.

Source

Thrown at homeassistant/components/ai_task/task.py:143

        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(
            session,
            GenDataTask(
                name=task_name,
                instructions=instructions,
                structure=structure,
                attachments=resolved_attachments or None,
                llm_api=llm_api,
            ),
        )

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Drop the attachments argument for this entity, or inline the needed context as text in instructions.
  2. Switch to an agent that advertises attachment support (feature flag visible on current OpenAI/Google/Anthropic conversation integrations).
  3. Update the conversation integration so SUPPORT_ATTACHMENTS is implemented.
  4. For images, pre-process to a description using an agent that does support attachments, then feed the text forward.
Defensive patterns

Strategy: validation

Validate before calling

def attachments_ok(entity, attachments) -> bool:
    """Attachments require the SUPPORT_ATTACHMENTS flag."""
    return not attachments or AITaskEntityFeature.SUPPORT_ATTACHMENTS in entity.supported_features

Type guard

def entity_accepts_attachments(entity) -> bool:
    """Narrowing guard for attachment-capable AI Task entities."""
    return AITaskEntityFeature.SUPPORT_ATTACHMENTS in entity.supported_features

Try / catch

from homeassistant.exceptions import HomeAssistantError

try:
    result = await async_generate_data(
        hass, entity_id=eid, task_name="t", instructions="...", attachments=atts
    )
except HomeAssistantError as err:
    if "does not support attachments" in str(err):
        atts = None  # degrade to text-only and retry
        result = await async_generate_data(hass, entity_id=eid, task_name="t", instructions="...")
    else:
        raise

Prevention

When it happens

Trigger: Calling ai_task.generate_data (or generate_image) with a non-empty attachments list against an agent whose provider/integration does not support file attachments (feature flag not advertised).

Common situations: Using a local or older LLM integration (e.g. Ollama before attachment support) with image/file attachments; mixing attachments into prompts for agents that only accept plain text.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/f156cb6b62fc5970. Report an issue: GitHub.