{"record":{"id":"ccd66f0dbb1e1873","repo":"home-assistant/core","slug":"unknownuser","errorCode":null,"errorMessage":"UnknownUser","messagePattern":"UnknownUser","errorType":"http","errorClass":"UnknownUser","httpStatus":401,"severity":"error","filePath":"homeassistant/components/assist_satellite/__init__.py","lineNumber":113,"sourceCode":"                    vol.Optional(\"start_media_id\"): _media_id_validator,\n                    vol.Optional(\"preannounce\", default=True): bool,\n                    vol.Optional(\"preannounce_media_id\"): _media_id_validator,\n                    vol.Optional(\"extra_system_prompt\"): str,\n                }\n            ),\n            cv.has_at_least_one_key(\"start_message\", \"start_media_id\"),\n        ),\n        \"async_internal_start_conversation\",\n        [AssistSatelliteEntityFeature.START_CONVERSATION],\n    )\n\n    async def handle_ask_question(call: ServiceCall) -> dict[str, Any]:\n        \"\"\"Handle a Show View service call.\"\"\"\n        satellite_entity_id: str = call.data[ATTR_ENTITY_ID]\n        if call.context.user_id:\n            user = await hass.auth.async_get_user(call.context.user_id)\n            if user is None:\n                raise UnknownUser(\n                    context=call.context,\n                    permission=POLICY_CONTROL,\n                    user_id=call.context.user_id,\n                )\n            if not user.permissions.check_entity(satellite_entity_id, POLICY_CONTROL):\n                raise Unauthorized(\n                    context=call.context,\n                    permission=POLICY_CONTROL,\n                    user_id=call.context.user_id,\n                    perm_category=CAT_ENTITIES,\n                )\n\n        satellite_entity: AssistSatelliteEntity | None = component.get_entity(\n            satellite_entity_id\n        )\n        if satellite_entity is None:\n            raise HomeAssistantError(\n                f\"Invalid Assist satellite entity id: {satellite_entity_id}\"","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/assist_satellite/__init__.py#L95-L131","documentation":"Home Assistant raises UnknownUser when a service call context carries a user_id that no longer resolves to a user in hass.auth. In the assist_satellite ask_question handler, the user record is fetched with hass.auth.async_get_user(call.context.user_id) and a None result triggers this error. It means the acting user was deleted or the context was fabricated/stale after the call was already accepted by the service layer.","triggerScenarios":"Calling assist_satellite.ask_question via the WebSocket/API with a context whose user_id belongs to a removed user; a long-lived token whose owner account was deleted; an automation or script replaying a stored context after user deletion.","commonSituations":"User account deleted while automations still reference it; restored database backup with stale auth tokens; test scripts that hand-craft ServiceCall contexts instead of using hass.services.async_call with a real context.","solutions":["Identify which automation/script/user context is making the call (check the error's context.user_id in the log traceback)","Recreate the user or update the automation to run under a valid user","Invalidate long-lived tokens belonging to the deleted user via the UI (Security > Long-lived access tokens)","If writing a custom integration, pass a real Context obtained from hass.auth, not a synthesized user_id"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"user = await hass.auth.async_get_user(context.user_id) if context.user_id else None\nif context.user_id and user is None:\n    # do not issue the service call; the user no longer exists\n    _LOGGER.warning(\"Refusing call for deleted user %s\", context.user_id)","typeGuard":null,"tryCatchPattern":"try:\n    await hass.services.async_call(..., context=context)\nexcept UnknownUser:\n    # stale user context: refresh tokens / drop stored contexts\n    raise","preventionTips":["Never hand-craft Context objects with arbitrary user_id values; obtain contexts from real requests","Purge stored long-lived tokens when deleting user accounts","Audit automations after removing users so no orphaned contexts remain"],"tags":["auth","service-call","assist-satellite","permissions"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}