core: Error handling request - config_entry.runtime_data
The problem
I can no longer re-authenticate myself. I always get the error “Unknown error occurred” ( even though the login worked according to the logs).
What version of Home Assistant Core has the issue?
core-2024.6.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Unifi
Link to integration documentation on our website
No response
Diagnostics information
2024-06-08 20:56:08.350 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://172.172.172.139:8443) get, None, {'allow_redirects': False}
2024-06-08 20:56:08.362 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://172.172.172.139:8443) 302 application/octet-stream <ClientResponse(https://172.172.172.139:8443) [302 None]>
<CIMultiDictProxy('Location': '/manage', 'Content-Length': '0', 'Date': 'Sat, 08 Jun 2024 18:56:07 GMT')>
2024-06-08 20:56:08.362 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://172.172.172.139:8443) b''
2024-06-08 20:56:08.362 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Talking to UniFi OS device: False
2024-06-08 20:56:08.362 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://172.172.172.139:8443/api/login) post, {'username': 'xxxx', 'password': 'xxx', 'rememberMe': True}, {}
2024-06-08 20:56:09.770 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://172.172.172.139:8443/api/login) 200 application/json <ClientResponse(https://172.172.172.139:8443/api/login) [200 None]>
<CIMultiDictProxy('Vary': 'Origin', 'Set-Cookie': 'unifises=xxx; Path=/; Secure; HttpOnly', 'Set-Cookie': 'csrf_token=xxx; Path=/; Secure', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '30', 'Date': 'Sat, 08 Jun 2024 18:56:09 GMT')>
2024-06-08 20:56:09.771 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://172.172.172.139:8443/api/login) b'{"meta":{"rc":"ok"},"data":[]}'
2024-06-08 20:56:09.771 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Logged in to UniFi https://172.172.172.139:8443/api/login
2024-06-08 20:56:09.771 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://172.172.172.139:8443/api/self/sites) get, None, {}
2024-06-08 20:56:09.773 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://172.172.172.139:8443/api/self/sites) 200 application/json <ClientResponse(https://172.172.172.139:8443/api/self/sites) [200 None]>
<CIMultiDictProxy('Vary': 'Origin', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '233', 'Date': 'Sat, 08 Jun 2024 18:56:09 GMT')>
2024-06-08 20:56:09.774 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://172.172.172.139:8443/api/self/sites) b'{"meta":{"rc":"ok"},"data":[{"anonymous_id":"xxx","name":"default","_id":"xxx","attr_no_delete":true,"attr_hidden_id":"default","desc":"Default","role":"admin","device_count":5}]}'
2024-06-08 20:56:09.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 70, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/unifi/config_flow.py", line 124, in async_step_user
return await self.async_step_site(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/unifi/config_flow.py", line 167, in async_step_site
hub = config_entry.runtime_data
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigEntry' object has no attribute 'runtime_data'
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 21 (7 by maintainers)
I will try to have a fix out for next release during this week
I accidentally fixed it reworking tests and that fix will be out with 2024.7. The work around fix suggested in this issue should be available with latest point release.
For me, removing the integration and reconfiguring from scratch solved the issue. I’ve lost all my entities, but at least I can use it again
I have a workaround, but I don’t know if there are any side effects.
You have to adjust the following file: /usr/src/homeassistant/homeassistant/components/unifi/config_flow.py Change Line 167 to:
Restart HomeAssistent and the re-authentication should work again.