[aiohttp.server] Error handling request (Trying again)

I have searched many hours now and also found many answers, but none of them are helping me.
So, I get this error in my log, a lot. It’s two of them every five minutes and it has increased lately.

2024-03-04 08:33:31.032 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 350, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “aiohttp/_http_parser.pyx”, line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
Invalid method encountered:
b’\x16\x03\x03’
^

I have read that using https from a device could cause it.
I’m not using DuckDNS (I used to, some years ago).
Using NabuCasa for remote access.

Have seen a lot of answers talking about base_url, ssl_certificate and so on, all of these are removed already.

Have 7 Android devices running the companion app.
The webhooks from the companion apps use https though, but I guess that it should, they go to nabu casa, like this:
https://hooks.nabu.casa/xxxxxx

Is there anyway I could get some more logging or something to find the source of the error.
Can you disable a companion app, without uninstalling it so it will not try to connect?
In that way I could rule out one by one.

Hope someone could point me in a new direction.

1 Like

In my case I am using cloudflared and tunnel to my hosted web site.

Any idea?

1 Like

…same issue. Cloudfare, NGINX proxy manager, static IP, port fwd into, HASS on Ubuntu. All current revs. Companion app is fine but Chrome browser on Android pops this msg. Phone browser (Samsung) allows me to login but pops up “Start Over” button. Clicking this takes you back to login page.

1 Like

Got the same issue, except it is only on one device on Android companion App. Working on browser and all other companion apps…

Anybody have pointers on this?

So on all my companions, iOS and Android, if the app is already connected, no issues. If I try to disconect/reconnect then I have the issue and can’t connect anymore.
No issued on website.

Dear all, I follow this post becouse I have the same problem.
Started with a issue with HA that not want connect and in the log I find it:

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 350, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Invalid method encountered:

    b'\x16\x03\x01'
      ^

But, the strange behaviour is that, I couldn’t connect to HA (both by remote and wifi ) but I received the notify.

HA Core : 2024.4.3
Frontend : 20240404.2
Docker version : 26.1.1

Have solved in some way?

Thank you all

Hello everyone!

I got the same random error handling request and I went to see the full log messages.

There is a line in the end of each error message with a value that keeps changing:
b'\x80' or b'' or b'\x16\x03' or b'\x16\x03\x01' or b'\x16\x03\x01\x01$\x01' or b'\x16\x03\x01'
It is really interesting because the value keeps changing to something different and at some point it actually says b'HELP' in the message which is really weird. Seems to me more like a human interaction than a simple error from an automation or integration.

It’s actually really scary because I don’t know if someone is trying to hack into my home assistant or something like that.

2024-06-17 23:10:46.412 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x80'

^

2024-06-17 23:10:46.641 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b''

^

2024-06-17 23:10:46.916 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'HELP'

^

2024-06-17 23:10:47.139 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x16\x03'

^

2024-06-17 23:10:47.449 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x16\x03\x01'

^

2024-06-17 23:10:47.468 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x16\x03\x01\x01$\x01'

^

2024-06-17 23:10:47.667 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x16\x03\x01'

^

2024-06-17 23:10:47.907 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 350, in data_received

messages, upgraded, tail = self._request_parser.feed_data(data)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message:

Invalid method encountered:

b'\x16\x03\x01'

^