WTH why is it still so difficult to decipher these web socket errors

lines like this:

2020-08-18 18:09:26 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2904765440] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds

even with debug set to homeassistant.components.websocket_api.http.connection, there’s nothing to go on and gives us no clue where to look. It would be really appreciated if the logger could provide more info to the source of these web socket errors.

here’s another one I just posted in another WTH thread.

2020-08-19 01:31:21 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139691397965184] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 230, in async_render
    return compiled.render(kwargs).strip()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py", line 460, in call
    if not __self.is_safe_callable(__obj):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1041, in is_safe_callable
    return isinstance(obj, AllStates) or super().is_safe_callable(obj)
  File "/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py", line 360, in is_safe_callable
    getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'split'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
    handler(self.hass, self, schema(msg))
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 265, in handle_render_template
    state_listener()
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 253, in state_listener
    msg["id"], {"result": template.async_render(variables)}
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 232, in async_render
    raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'split'

WTH does that even mean and how can I fix it?

Ive had the above error too, and it was solved by searching all templates for the .split or |split filter. Apparently you’re trying to template a non existing entity somewhere.

using the One condition to Rule them All will solve that:

    condition:
      - condition: template
        value_template: >
          {{trigger.to_state is not none and
            trigger.from_state is not none and
            trigger.to_state.state != trigger.from_state.state}}

that is, if you can find the culprit of course :wink:

1 Like

Sorry, I should have finalized that post differently.

I knew it was related to a non-existent entity using a split.

But everything else in there is totally confusing and distracting. And it doesn’t even end up helping you find the actual thing that’s causing the error. You still have to wade thru your entire config and find the place that might have a template containing an entity that isn’t available immediately after HA restarts and throws the error then becomes perfectly working thereafter.

ok sorry, would have expected you to know that…

still the solution I suggested is working, so add that to your automation, or use the phrase in your template sensor and you’re set?

1 Like

That’s a stack trace. It helps you find the error. Work from the bottom up, not from the top down.

Think of it like a printer. The last thing printed is where the error occurred. These errors are unavoidable unless they can be caught. I.e. you need to know about the error before it happens. Sometimes that’s not possible.

Not trying to make @finity 's issue smaller, but the

Client unable to keep up with pending messages. Stayed over 512 for 5 second

is a very specific Error I cant find the source for at all. Nothing in the logs telling me to look where, of any hint what kind of card/interface/integration causes it. Only this:

components/websocket_api/http.py:138 

which is https://github.com/home-assistant/core/blob/993088d26e93f7d753e8477eb4a77391bc36e1a2/homeassistant/components/websocket_api/http.py#L138

again, no leads, simple the source code for the error ;-(

the stack traces are complex too sometimes (most of the times) but as you say, look up and see shall find.

This seems to be something else though. or?

Yeah, I know. And that was just an example that I had readily available. And I wasn’t asking for help in figuring out that specific error.

But my point was that generally the wall of error text is unhelpful and distracting. Especially if it doesn’t lead you to a reasonable way to find the source or what to do to fix it in many cases.

So, for example, in the case above it knows there’s an error in a template. Why not tell you the automation/script/sensor/ etc which is the source of the error? Instead it tells you where in the source code the error was generated.

noted, won’t bother you again.

Dude, don’t take everything I say as a personal attack and get all huffy.

I was just trying to clarify what my intent was in posting that specific error.

I know your upset with me from the other thread but come on. (I think) we’re both adults here.

Not upset at all. Its just hard to read inflection from text :wink:

1 Like

Were you able to find the source of the error? I am getting the exact same thing (am on 0.115.4).

no, but tbh, and I dont know why, but I don’t see these anymore… #fingerscrossed. Maybe I just suppressed them by changing the loglevel, not sure. default level is still on ‘error’

1 Like