home-assistant/core · error · HomeAssistantError
AI Task entity {entity_id} does not support generating image
Error message
AI Task entity {entity_id} does not support generating images What it means
HomeAssistantError from ai_task.async_generate_image when the entity exists but supported_features lacks AITaskEntityFeature.GENERATE_IMAGE. Only agents whose backend can produce images (and whose integration implements internal_async_generate_image) advertise this flag; text-only agents are rejected here before the chat session is even opened.
Source
Thrown at homeassistant/components/ai_task/task.py:182
*,
task_name: str,
entity_id: str | None = None,
instructions: str,
attachments: list[dict] | None = None,
) -> ServiceResponse:
"""Run an image generation task in the AI Task integration."""
if entity_id is None:
entity_id = hass.data[DATA_PREFERENCES].gen_image_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_IMAGE not in entity.supported_features:
raise HomeAssistantError(
f"AI Task entity {entity_id} does not support generating images"
)
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)
task_result = await entity.internal_async_generate_image(
session,
GenImageTask(
name=task_name,View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Target an image-capable agent: pass the entity_id of an integration whose models generate images (current OpenAI image models via the OpenAI conversation integration, Google Gemini image models, etc.).
- Update the provider integration to a version implementing AI Task image generation.
- Custom agents: implement internal_async_generate_image and set AITaskEntityFeature.GENERATE_IMAGE.
- For text-only agents, use ai_task.generate_data instead.
Defensive patterns
Strategy: validation
Validate before calling
def supports_gen_image(entity) -> bool:
"""Entity advertises image-generation capability."""
return AITaskEntityFeature.GENERATE_IMAGE in entity.supported_features Type guard
def is_image_capable_ai_task_entity(entity) -> bool:
"""Narrowing guard: registered and GENERATE_IMAGE-capable."""
return (
hasattr(entity, "supported_features")
and AITaskEntityFeature.GENERATE_IMAGE in entity.supported_features
) Try / catch
from homeassistant.exceptions import HomeAssistantError
try:
resp = await async_generate_image(hass, entity_id=eid, task_name="img", instructions="...")
except HomeAssistantError as err:
if "does not support generating images" in str(err):
# switch to an image-capable agent id and retry
raise
raise Prevention
- Point generate_image only at agents with image models behind them.
- Update provider integrations so the image feature flag is implemented.
- Custom agents: implement internal_async_generate_image and set the flag.
When it happens
Trigger: Calling ai_task.generate_image against a text-only conversation agent — entity resolves fine, but the GENERATE_IMAGE bit is absent.
Common situations: Default preference left on a plain chat model; local LLM setups (Ollama etc.) without image output; provider integrations that have not implemented the image API yet.
Related errors
- AI Task entity {entity_id} does not support generating data
- AI Task entity {entity_id} does not support attachments
- AI Task media source requires at least one media directory c
- Only local attachments are currently supported
- No entity_id provided and no preferred entity set
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/47120f3a440d9700.
Report an issue: GitHub.