home-assistant/core · warning · HomeAssistantError

subentry_not_found

Error message

subentry_not_found

What it means

A HomeAssistantError with translation key 'subentry_not_found' raised in the Anthropic repairs flow's update handler when the stored entry id or subentry id no longer resolves: async_get_entry returns None, the entry has no such subentry, or either id was never set. It protects async_update_subentry from operating on stale state.

Source

Thrown at homeassistant/components/anthropic/repairs.py:180

            self._current_entry_id = entry_id
            self._current_subentry_id = subentry_id
            return entry, subentry, model

    def _async_update_current_subentry(self, user_input: dict[str, str]) -> None:
        """Update the currently selected subentry."""
        if (
            self._current_entry_id is None
            or self._current_subentry_id is None
            or (
                entry := self.hass.config_entries.async_get_entry(
                    self._current_entry_id
                )
            )
            is None
            or (subentry := entry.subentries.get(self._current_subentry_id)) is None
        ):
            raise HomeAssistantError(
                translation_domain=DOMAIN, translation_key="subentry_not_found"
            )

        updated_data = {
            **subentry.data,
            CONF_CHAT_MODEL: user_input[CONF_CHAT_MODEL],
        }
        self.hass.config_entries.async_update_subentry(
            entry,
            subentry,
            data=updated_data,
        )

    def _format_subentry_type(self, subentry_type: str) -> str:
        """Return a user-friendly subentry type label."""
        if subentry_type == "conversation":
            return "Conversation agent"
        if subentry_type in ("ai_task", "ai_task_data"):

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Dismiss the stale repair dialog and re-open the repair from the Repairs panel against an entry that still exists
  2. Verify the config entry and its subentries still exist under Settings > Devices & Services before submitting
  3. Restart the repair flow if the entry was recreated
Defensive patterns

Strategy: validation

Validate before calling

def subentry_alive(hass, entry_id: str | None, subentry_id: str | None) -> bool:
    if entry_id is None or subentry_id is None:
        return False
    entry = hass.config_entries.async_get_entry(entry_id)
    return entry is not None and subentry_id in entry.subentries

Try / catch

if self._current_entry_id is None or self._current_subentry_id is None or (entry := ...) is None or (subentry := ...) is None:
    raise HomeAssistantError(translation_domain=DOMAIN, translation_key="subentry_not_found")

Prevention

When it happens

Trigger: User opens a repair flow for a deprecated model subentry, but the config entry or subentry is deleted (or the flow state reset) before submitting the form — self._current_entry_id/_current_subentry_id then dangle.

Common situations: Repair dialog left open while the user (or another session) deletes the assistant config entry; multiple repair flows racing on the same subentry; browser back/forward resubmitting a stale form.

Related errors


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