ERROR (MainThread) [aiohttp.server] Error handling request

I’m getting this error on my home-assistant.log, everything was working fine. Don’t have any idea of what could it be.

ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 278, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 273, in aiohttp._http_parser.HttpParser.feed_data (aiohttp/_http_parser.c:4351)
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

which version of HA are you using ? Have you tried to upgrade to the latest version ?

I’m using v 0.46.1, I’ve also tried with dev version.
I’m running HA on my Synology NAS using the official docker image.

Tried a fresh install of both versions with same error.

Sorry for hijacking the thread, but this was the only ticket I could find Googling. The problem still persists. I’m experiencing this on a clean install with Docker on 0.49.0

2017-07-17 23:59:55 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 278, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 274, in aiohttp._http_parser.HttpParser.feed_data (aiohttp/_http_parser.c:4364)
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

1 Like

Almost the same by me, using the latest version (0.49.1), but I was experiencing it right before the upgrade as well:

2017-07-28 16:56:51 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/aiohttp/web_protocol.py”, line 278, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 274, in aiohttp._http_parser.HttpParser.feed_data (aiohttp/_http_parser.c:4364)
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

Hey peeps i’m getting the same issue. Did this get resolved?

I found this problem on my docker install of hass. It stoped when Im added the base_url on the configuration file. I matched the base url with the url i’m using to access the docker container (hass.mydomain.com:8123) and now the error is gone.

I got this error after one of my cameras went dead. Error was resolved after a re-boot of the camera.

I am getting this error and after a little debugging it looks like this exception will occur any time something tries to connect using HTTPS and hass is setup for HTTP.

Months later, new install, same issue. This time… Spaces!!. I had

 http:
   ssl_certificate: ...

There was a space at the beginning of the http line. No errors on check. It was driving me crazy!!.. YAML is insanely strict, but you usually you get formatting errors, not this time, just a weird behavior.

4 Likes

hi all - i fixed this by adding the full address of the site into the http: component under base_url
I believe the error comes is caused in most instances by using https without having this set in the configuration.yaml

http:
  base_url: https://hass.example.com
2 Likes

I’ve always had it in that format so don’t think it’s the issue…

THANK YOU FOR THIS!
I was bashing my head against the wall. A FRIKKIN SPACE!!! Deleted it, solved.

1 Like

If you use VSCode look into the ‘YAML’ linter which will highlight YAML errors in your configs. :slight_smile:

1 Like

This did it for me also. Running Home Assistant in docker.

Thanks!

hello, i am having the same issue on a fresh synology vmm installation, from hassos_ova-5.9.vmdk & hassos_ova-5.8.vmdk images.

2020-12-21 10:06:57 ERROR (MainThread) [frontend.js.latest.202012120] chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/prompt.js:1:1 Uncaught SyntaxError: Identifier ‘originalPrompt’ has already been declared

2020-12-21 10:10:03 ERROR (MainThread) [frontend.js.latest.202012120] chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/prompt.js:1:1 Uncaught SyntaxError: Identifier ‘originalPrompt’ has already been declared

2020-12-21 10:28:19 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 314, in data_received

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

File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘invalid HTTP method’”

2020-12-21 10:28:19 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 314, in data_received

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

File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘invalid HTTP method’”

2020-12-21 10:28:19 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 314, in data_received

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

File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘invalid HTTP method’”

2020-12-21 10:28:19 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 314, in data_received

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

File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data

aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘invalid HTTP method’”

2020-12-21 10:28:26 ERROR (MainThread) [frontend.js.latest.202012120] chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/prompt.js:1:1 Uncaught SyntaxError: Identifier ‘originalPrompt’ has already been declared

2020-12-21 10:29:36 ERROR (MainThread) [frontend.js.latest.202012120] chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/prompt.js:1:1 Uncaught SyntaxError: Identifier ‘originalPrompt’ has already been declared

i understand it is because of url https, but how can i fix it ???

no more solution in https://github.com/home-assistant/core/issues/17387

tks in advance.
Arnaud

I have the same error: It has to do something with my Denon Speakers “saying” an .MP3 alarm message.

I use this syntax in my Node-red automation. What is wrong with the Syntax??
I tried without adding the port number :8123. And I tried with https://
I get always the same error. See below
PS: The message is played correctly on my Denon Heas

Syntax in Node-red is:
{
“media_content_type”: “url”,
“media_content_id”: “http://192.168.0.130:8123/local/beweging_gedetecteerd_man.mp3
}

Error message received:
2021-01-21 14:04:45 DEBUG (MainThread) [pyheos.connection] Event received for player {Heos Bureau (HEOS 3)}: {‘command’: ‘event/player_playback_error’, ‘message’: ‘pid=2021190917&error=Unable to play media. Please try again later.’}

2021-01-21 14:04:45 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):

File “/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py”, line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)

File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line ‘invalid HTTP method’"

yeah, same for me!
thanks!

Same issue here

Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:393
First occurred: 22:44:45 (4 occurrences)
Last logged: 22:47:20

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘invalid HTTP method’”

I am also experiencing this same issue and no one seems to want to help. Its a pretty generic error message so its hard for me to debug. What I read from another thread is that someone is pinging the server because we’re using duckDNS. Are you guys all using duckDNS?