Is there any way to hide the "Generic MJPEG IP Camera" urllib3 Errors

I now have 3 MJPEG cameras and my error log fills with the errors that the page says I can safely ignore, but they are pretty annoying. Is there any way to fix or hide the errors?

Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 404, in _make_request
    assert_header_parsing(httplib_response.msg)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/response.py", line 59, in assert_header_parsing
    raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
requests.packages.urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
16-09-06 16:06:58 requests.packages.urllib3.connectionpool: Failed to parse headers (url=http://IPADDRESS/cgi-bin/video.cgi?msubmenu=mjpg): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
1 Like

Fix? Not until they fix it in urlib3 - and it’s been an open issue since February.

Hide? You can set the level of logging, as long as you don’t mind missing other errors at that level.

This page will show you how to change logger options:

2 Likes

Thanks, this helped.

1 Like

Hi. Sorry for my ignorance, but what logging level would hide these but keep everything above that?
In other words, what’s the least I can reduce my logging to hide these messages?
Thanks!

1 Like

These errors are making my logs hard to follow. Could someone please suggest how to reduce/remove them and still show the most other output in the logs?
Thanks!

homeassistant.components.camera: error
As described here: https://home-assistant.io/components/logger/

Thank you. That helped. My logs are much nicer when I ignore the errors :slight_smile:

I gave the same solution two posts above, you must have missed it.

However I found that when I specified the authentication method and included the username and password, I no longer get these errors.

# Rear Camera
- platform: mjpeg
  mjpeg_url: !secret cam3_url
  authentication: digest
  name: rear facing controllable
  username: !secret cam_user
  password: !secret cam_password

The earlier solution was a link to the docs, which I didn’t understand much when I read them :slight_smile:
Your actual code for my specific situation helped me understand them a little bit more.

I’ll have a look at your new addition here, thanks.

1 Like

I was hopeful but that just makes the camera not work for me! Bummer.

Sorry. I guess you can use the argument homeassistant.components.cameras: fatal in logger to set the level to filter them out at least.

Perhaps I’m (still) doing something wrong?

Here’s my configuration.yaml:

  # Name of the location where Home Assistant is running
  name: Redacted Home
  # Location required to calculate the time the sun rises and sets
  latitude: xxx
  longitude: -yyy
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 254
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Indiana/Indianapolis

  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

logger:
  default: info
  logs:
    homeassistant.components.camera: fatal

Still getting warnings at regular intervals. Thoughts? I appreciate your help :slight_smile:

I’m stumped. Between the changes I made to my camera setup (which you duplicated) and adding this to my log setup:

logger:
  default: error
  logs:
    homeassistant.components.media_player.firetv: fatal
    homeassistant.components.media_player.cast: fatal
    homeassistant.components.cameras: fatal
    homeassistant.components.wink: critical

I’m not seeing any errors anymore. The only thing that appears different in the default level - which you have set to info. You can try switching that to error, but after that I don’t know what else you could do differently than I did.

The key is to target urllib3, not so much the hass component. Try adding this log line:

requests.packages.urllib3: critical
2 Likes

Oh man, I wish I’d figured that out - thanks!!

I wonder why mine is working though?

Hi,

i know this post is atleast a year old but i’m experiencing the same problem:

2018-02-23 14:04:17 WARNING (Thread-22) [urllib3.connectionpool] Failed to parse headers (url=http://xxxx:80/html/cam_pic_new.php): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 399, in _make_request
    assert_header_parsing(httplib_response.msg)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/response.py", line 66, in assert_header_parsing
    raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''

i did configure

logger:
  default: warning
  logs:
    requests.packages.urllib3: critical
    homeassistant.components.camera: critical

but the errors are still showing up on the home-assistant.log.

any idea of how may that be?

3 Likes

Try adding this instead:

logger:
  default: warning
  logs:
    requests.packages.urllib3.connectionpool: critical

Have this same issue, none of these work for me. I’m sure setting the default logging level to error of above would work, but I don’t really wan to do that.

Was this ever resolved? I tried every possible combination for logger but still get this annoying message:
Failed to parse headers (url=http://xxxxxxx:80/mjpg/video.mjpg): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: '' Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 396, in _make_request assert_header_parsing(httplib_response.msg) File "/usr/local/lib/python3.6/site-packages/urllib3/util/response.py", line 66, in assert_header_parsing raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''

If you want to get rid of the errors, you can make a fairly simple edit your lib/python3.6/site-packages/urllib3/connectionpool.py (full path will depend on your venv/install location) file.

On line 394, change: log.warning(… to log.debug(… and restart HA.

That will switch the warning to a debug warn level so it shouldn’t show up in HA unless you have your log level set to debug.

1 Like