home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.07k stars 30.18k forks source link

aiohttp.server message="Bad status line 'Invalid method encountered'" #73885

Open KitHubek opened 2 years ago

KitHubek commented 2 years ago

The problem

After upgrade to newest 2022.6.7 i see this error at logs

What version of Home Assistant Core has the issue?

2022.6.7

What was the last working version of Home Assistant Core?

i dont remember

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:405
First occurred: 03:36:42 (3 occurrences)
Last logged: 08:20:30

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

Additional information

No response

lubosjerabek commented 2 years ago

I have the same issue after upgrading my containerized HA from 2022.5.2 to 2022.6.7

Error I'm seeing:

File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

This happens upon startup since the upgrade. Using old container fortunately worked okay

tomhash2 commented 2 years ago

Not an issue in my case.

After searching on the internet I came to conclusion that one of my devices in LAN is trying to connect to :8123 port using HTTPS.

I've reviewed all phones and tablets and turned out it was my sons device.

This was coincidence that it happened after upgrade.

Dutchstyler commented 2 years ago

Having the same error and occors 18 times, but not every day:

Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 2 augustus 2022 om 16:48:11 (18 occurrences) Last logged: 05:36:10

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

Running on RPI4 - core-2022.7.3 - Home Assistant OS 8.4

vaibhav2912 commented 2 years ago

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

vaibhav2912 commented 2 years ago

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

UPDATE: I did grep for my IP address in the config directory and found one auth token that was using https on my old IP address:8123.

grep result: .storage/auth:462: "client_id": "https://192.168.1.108:8123/"

I opened config/.storage/auth file, went to this auth entry, found the device ID and searched for that again in the config directory. It was from my Galaxy watch. I have removed the auth token now.

Might be helpful for people to search for devices using HTTPS for port 8123 to reach HA instance.

BUT, in my case, I didn't change the IP address on my watch after I changed my HA IP. So, the watch couldn't have pinged my new IP with HTTPS and port 8123. So the aiohttp errors I got today morning (posted in the quoted message) are definitely not from my watch pinging 8123 using HTTPS.

I will report back if I see the errors again.

vaibhav2912 commented 2 years ago

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

UPDATE: I did grep for my IP address in the config directory and found one auth token that was using https on my old IP address:8123.

grep result: .storage/auth:462: "client_id": "https://192.168.1.108:8123/"

I opened config/.storage/auth file, went to this auth entry, found the device ID and searched for that again in the config directory. It was from my Galaxy watch. I have removed the auth token now.

Might be helpful for people to search for devices using HTTPS for port 8123 to reach HA instance.

BUT, in my case, I didn't change the IP address on my watch after I changed my HA IP. So, the watch couldn't have pinged my new IP with HTTPS and port 8123. So the aiohttp errors I got today morning (posted in the quoted message) are definitely not from my watch pinging 8123 using HTTPS.

I will report back if I see the errors again.

Saw the same error messages again. So what I did above didn't solve it.

2022-08-13 23:33:53.827 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
2022-08-13 23:33:55.044 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'
controlcde commented 1 year ago

Any progress on this issue? I´ve got the error more than once (see above).

Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 
First occurred: 2:13:21 PM (959 occurrences) 
Last logged: 2:14:59 PM

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

Is there I could do to present more details?

rajalingamj175 commented 1 year ago

I'm facing same issue. Please help

Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.202 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.699 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.732 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.766 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.795 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.826 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

m-reiner commented 1 year ago

Same issue here, any updates on this?

I have a feeling it relates back to Nginx, which I'm using to reverse-proxy to my HA instance. I don't have any issues (I don't think) from the app on iOS, but when using Firefox on my laptop it can take ages to load HA through the reverse proxy and I see the same errors others are reporting...

baldus88 commented 1 year ago

Hi.

I have similar error in my case after update HA 2022.12. My environment: HA Core (docker version).

This is the log:

2022-12-16 13:08:27.734 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

In log have 9 occurrences

Thanks

GarnetSunset commented 1 year ago

Same issue here for me!

Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405
First occurred: 11:43:34 AM (5 occurrences)
Last logged: 11:44:11 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
fuzzybear62 commented 1 year ago

Same issue:

HA 2023.01.1

Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 16:42:05 (1 occurrences) Last logged: 16:42:05 Error handling request

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

pkleingu commented 1 year ago

Same here: 2023-01-23 00:14:23.930 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

jum0n commented 1 year ago

Similar here, message is different: Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 3:22:08 PM (1 occurrences) Last logged: 3:22:08 PM Error handling request

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

MakStashkevich commented 1 year ago

Same here:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 332, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

jocamane commented 1 year ago

87861

cayco commented 1 year ago
Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405
First occurred: 12:21:51 (12175 occurrences)
Last logged: 19:25:40

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
borez commented 1 year ago

Getting the same issues, and have isolated it down to my iOS home companion app remote accessing the HA instance, via external URL. Accessing the HA instance via internal URL has no issues.

In my case, I am accessing it remotely via http (unsecured) via duckdns, and with my router port forwarding 8123 to the HA device.

jocamane commented 1 year ago

In my case, I am accessing it remotely via https (secured) via duckdns, and with my router port forwarding 8123 to the HA device

borez commented 1 year ago

To add on, I get the same error as long I’m using external URL functionality. Used an internal IP on the external URL section, via wifi.

nodermann2 commented 1 year ago

Double-check the URL you're using in your request. Make sure it's correctly formatted and that there are no extra characters or spaces. Ensure the URL scheme (http/https) is correct for the API you're using. I had a similar problem, I specified the port to a URL, but it was not necessary.

Vladimirlashuk commented 1 year ago

I found out that such errors occur when the https://about.censys.io/ service sends requests like: 167.94.138.126 [28/Apr/2023:01:49:57 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys. io/)" On their official website, you can see from which ip addresses this happens and block them on the server->> https://support.censys.io/hc/en-us/articles/360043177092-Opt-Out-of-Data-Collection

jocamane commented 1 year ago

I found out that such errors occur when the https://about.censys.io/ service sends requests like: 167.94.138.126 [28/Apr/2023:01:49:57 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys. io/)" On their official website, you can see from which ip addresses this happens and block them on the server->> https://support.censys.io/hc/en-us/articles/360043177092-Opt-Out-of-Data-Collection

But I don't have censys service !!!

mitag commented 1 year ago

Same here, using NGINX Home Assistant SSL proxy 3.5.0 2023.6.1 Home Assistant OS 10.2

benwainwright commented 1 year ago

Same Problem here

Coder84619 commented 1 year ago

I did a fresh install of HAOS 10.3 with 2023.6 and then immediately installed the Let's Encrypt add-on and issued a wildcard SSL cert. When I restart HA and attempt to access HA via HTTPS it fails, and I see the error in this thread in the log.

hkphh commented 1 year ago

guys, have a same problem my HA works in docker by typing docker logs homeassistant i see:

2023-06-30 00:41:32.471 ERROR (MainThread) [homeassistant.components.http.forwarded] Received X-Forwarded-For header from an untrusted proxy 172.28.0.1

the ip 172.28.0.1 is my docker network. I just added this net to trusted proxy and it all work fine now. I also usng https with duckdns. Hope my solution will help you

My nginx.conf with reverse proxy on it

server { server_name homeassistant.bla.bla; proxy_ssl_server_name on; location / { proxy_ssl_name $host; proxy_pass http://localhost:8123; #HA is on 80 port, docker listen 8123 proxy_set_header Host $host; proxy_pass_header Authorization;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
} listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/homeassistant.bla.bla/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/homeassistant.bla.bla/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }

server { if ($host = homeassistant.bla.bla) { return 301 http://$host:8123$request_uri; } # managed by Certbot server_name homeassistant.bla.bla; listen 80; return 404; # managed by Certbot }

rynewang commented 1 year ago

This may be related to this issue: https://github.com/aio-libs/aiohttp/issues/7208

Basically, if the request does not set content-length, aiohttp server returns 400 with Invalid method encountered.

tricksel commented 1 year ago

It happens to me right now when calling Google Translate TTS.

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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: Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n ^"

Marco4223 commented 12 months ago

Same issue on my side: 2023-10-08 17:02:25.552 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 332, 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: Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n ^"

JohnBull-1975 commented 12 months ago

same error in log here, but I didn't do anything with HA at the time it appeared. I think I have seen the same message a few times last days, but not sure it's exactly the same.

Logger: aiohttp.server Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403 First occurred: 19:15:37 (1 occurrences) Last logged: 19:15:37

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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.BadHttpMessage: 400, message: Pause on PRI/Upgrade:

b''
  ^
ur7x commented 11 months ago

Add me to the list too... Same error. Been working on it for weeks. Nothing fixes it.

Derekzielinski commented 11 months ago

Same error here.

Marco4223 commented 11 months ago

Just a small note. Now that I use https with a valid let's encrypt certificate for my domain, the error has not occurred for 5 hours. I also found this hind but wasen't able to test it. Maybe someone else can do so? https://serverfault.com/questions/195622/what-is-this-in-error-log-invalid-method-in-request-x16-x03-x01

JohnBull-1975 commented 11 months ago

I have used https with let's encrypt cetificate since my on boarding days almost a year ago and I have this error almost daily

aletzi1 commented 11 months ago

Same error here, everyday.... Any ideas how to fix it ? I use duckdns.

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 10.45.41 (1 occurrences)
Last logged: 10.45.41

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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:
  Bad status line "Invalid method encountered:\n\n  b''\n    ^"
masi commented 11 months ago
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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:
  Bad status line "Invalid method encountered:\n\n  b'\\x16\\x03\\x01\\x02\\x8a\\x01'\n    ^"

I have shortly tried Nginx/DuckDNS but have disabled the add-ons now.

Motzumoto commented 11 months ago

Also experiencing the same issue.

ZorianNL commented 11 months ago

Same issue here, just bought the wifi dongle for my heatpump, tried to set it up in HA but experienced this error upon logging in to MelCloud.

jocamane commented 11 months ago

Logger: aiohttp.server Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403 First occurred: November 5, 2023 at 20:41:40 (9 occurrences) Last logged: 17:53:40

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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: Bad status line 'Invalid method encountered:\n\n b\'{"id": 1, "method": "mining.subscribe", "params": ["cpuminer/2.5.1"]}\'\n ^'

ur7x commented 11 months ago

Same issue here, just bought the wifi dongle for my heatpump, tried to set it up in HA but experienced this error upon logging in to MelCloud.

I think it is a malformed Webhook somewhere. When I turned off all of the "auto" webhooks in MotionEye the number of errors went from Dozens and Dozens to one or two per day. Very weird, rare and odd error.

It would be nice if the error message was a little more descriptive.

masi commented 11 months ago

Any chance to track it down? Are there any log levels we could raise to get more insights?

zhuchkov-artem commented 11 months ago

same problem :(

ur7x commented 10 months ago

One thing that is really odd with this error... When I either SSH in or use the terminal and start to navigate the directory tree... the file usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py does not exist. In fact I don't seem to have a python3.11 directory.

bartj12 commented 10 months ago

Following, same error here. Looking for a solution.

qixiaoyu718 commented 10 months ago

hello, everyone,i found to use aiohttp=3.8.5 no error, you can try it. image

ur7x commented 10 months ago

hello, everyone,i found to use aiohttp=3.8.5 no error, you can try it.

Is there a link/documentation on how to install 3.8.5?

msemik commented 10 months ago

Running my HA in docker container on synology NAS, exposed using reverse proxy (nginx) an issue started appearing today after isp maintenance. I have the aiohttp=3.8.5

image
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 20:45:55 (28 occurrences)
Last logged: 20:46:01

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, 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:
  Bad status line "Invalid method encountered:\n\n  b'\\x16\\x03\\x01\\x02/\\x01'\n    ^"
oleg-d commented 10 months ago

Exactly same error for me ^

aletzi1 commented 9 months ago

Still active issue.