{"record":{"id":"47120f3a440d9700","repo":"home-assistant/core","slug":"ai-task-entity-entity-id-does-not-support-genera-47120f","errorCode":null,"errorMessage":"AI Task entity {entity_id} does not support generating images","messagePattern":"AI Task entity (.+?) does not support generating images","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/ai_task/task.py","lineNumber":182,"sourceCode":"    *,\n    task_name: str,\n    entity_id: str | None = None,\n    instructions: str,\n    attachments: list[dict] | None = None,\n) -> ServiceResponse:\n    \"\"\"Run an image generation task in the AI Task integration.\"\"\"\n    if entity_id is None:\n        entity_id = hass.data[DATA_PREFERENCES].gen_image_entity_id\n\n    if entity_id is None:\n        raise HomeAssistantError(\"No entity_id provided and no preferred entity set\")\n\n    entity = hass.data[DATA_COMPONENT].get_entity(entity_id)\n    if entity is None:\n        raise HomeAssistantError(f\"AI Task entity {entity_id} not found\")\n\n    if AITaskEntityFeature.GENERATE_IMAGE not in entity.supported_features:\n        raise HomeAssistantError(\n            f\"AI Task entity {entity_id} does not support generating images\"\n        )\n\n    if (\n        attachments\n        and AITaskEntityFeature.SUPPORT_ATTACHMENTS not in entity.supported_features\n    ):\n        raise HomeAssistantError(\n            f\"AI Task entity {entity_id} does not support attachments\"\n        )\n\n    with async_get_chat_session(hass) as session:\n        resolved_attachments = await _resolve_attachments(hass, session, attachments)\n\n        task_result = await entity.internal_async_generate_image(\n            session,\n            GenImageTask(\n                name=task_name,","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/ai_task/task.py#L164-L200","documentation":"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.","triggerScenarios":"Calling ai_task.generate_image against a text-only conversation agent — entity resolves fine, but the GENERATE_IMAGE bit is absent.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def supports_gen_image(entity) -> bool:\n    \"\"\"Entity advertises image-generation capability.\"\"\"\n    return AITaskEntityFeature.GENERATE_IMAGE in entity.supported_features","typeGuard":"def is_image_capable_ai_task_entity(entity) -> bool:\n    \"\"\"Narrowing guard: registered and GENERATE_IMAGE-capable.\"\"\"\n    return (\n        hasattr(entity, \"supported_features\")\n        and AITaskEntityFeature.GENERATE_IMAGE in entity.supported_features\n    )","tryCatchPattern":"from homeassistant.exceptions import HomeAssistantError\n\ntry:\n    resp = await async_generate_image(hass, entity_id=eid, task_name=\"img\", instructions=\"...\")\nexcept HomeAssistantError as err:\n    if \"does not support generating images\" in str(err):\n        # switch to an image-capable agent id and retry\n        raise\n    raise","preventionTips":["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."],"tags":["homeassistant","ai-task","image-generation","feature-flags"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}