Aiohttp error in supervisor logs when loading any ingress add-on

I get this error in the supervisor logs and a

500 Internal Server Error

Server got itself in trouble 

whenever I attempt to load the ui for a plugin that uses ingress (node-red, terminal)
the node red flows I have are running and controlling the system.
Has anyone seen this issue or know how to remedy or what the root cause might be?

23-11-01 14:02:31 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/aiohttp.py", line 139, in sentry_app_handle
    reraise(*_capture_exception(hub))
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/_compat.py", line 115, in reraise
    raise value
  File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/aiohttp.py", line 129, in sentry_app_handle
    response = await old_handle(self, request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 185, in block_bad_requests
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 201, in system_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 220, in token_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 280, in core_proxy
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/ingress.py", line 141, in handler
    return await self._handle_request(request, addon, path, session_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/ingress.py", line 217, in _handle_request
    async with self.sys_websession.request(
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1167, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 584, in _request
    resp = await req.send(conn)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 667, in send
    await writer.write_headers(status_line, self.headers)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 129, in write_headers
    buf = _serialize_headers(status_line, headers)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_writer.pyx", line 132, in aiohttp._http_writer._serialize_headers
    _safe_header(to_str(val))
  File "aiohttp/_http_writer.pyx", line 116, in aiohttp._http_writer._safe_header
    raise ValueError(
ValueError: Newline or carriage return character detected in HTTP status message or header. This is a potential security issue.

What version of HA are you running? There was an update to aiohttp in 2023.10.2 which caused issues and was reverted in 2023.10.3. Could this be the cause?

thanks for the reply! This is what Iā€™m running:

  • Core2023.11.0
  • Supervisor2023.10.1
  • Operating System11.1
  • Frontend20231030.1

So this is a beta version of HA? Maybe there are issues not yet resolved.

EDIT: sorry see this was released yesterday. Is it Nov already!

1 Like

Found that this error is caused by a homebridge instance on the same network as my HA instance. Turning off homebridge and rebooting the RPI running HA allows me to load ingress UI. Once I turn homebridge back on the error comes right back.