SniTun - Connection Problem and Challenge Error

A few weeks back the NubaCasa servers were updated/upgraded. Since then I’ve noticed the following two errors in the HA Logs following every server restart.

Logger: hass_nabucasa.remote
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/remote.py:311
First occurred: August 7, 2021, 1:52:42 PM (2 occurrences)
Last logged: August 7, 2021, 1:52:51 PM

Connection problem to snitun server

and

Logger: snitun.client.client_peer
Source: /usr/local/lib/python3.9/site-packages/snitun/client/client_peer.py:84
First occurred: August 7, 2021, 1:52:42 PM (2 occurrences)
Last logged: August 7, 2021, 1:52:51 PM

Challenge/Response error with SniTun server

These errors only appear once, immediately following a server restart. HA is running on an HA Blue. Why are these errors appearing.

EDIT: There is an open Issue at Github associated with this error: Challenge/Response error with SniTun server · Issue #41420 · home-assistant/core · GitHub

3 Likes

It is also happening to me. However, this is not affecting NabuCasa in any way.

It doesn’t seem to affecting my NabuCasa connection either.

I found an open Issue at Github associated with this error: Challenge/Response error with SniTun server · Issue #41420 · home-assistant/core · GitHub

I read all the comments and so far there isn’t a solution. It appears to be something intermittent that isn’t affecting a bunch of users. I included my logs there in the hopes that they could shed some light on this problem.

1 Like

Thank you for pointing this issue out. I have added my information to it.

I have this error two

Exact text is

2021-08-31 00:04:41 ERROR (MainThread) [snitun.client.client_peer] Challenge/Response error with SniTun server

2021-08-31 00:04:41 ERROR (MainThread) [hass_nabucasa.remote] Connection problem to snitun server

I experienced having my HA kicked out so I had to login again. And then neither Alexa nor Google worked. I had the advice on Discord to logout and login again. That fixed the Alexa/Google issue. But the error message remains. I also added my info to the github

I experience 1 of 3 Alexa commands to respond with “Sorry something went wrong”. Something I normally experience 1-2 times per week. This evening where I had another problem unrelated I had to test many times and I could experience a poor reliability with the Nabu Casa/Alexa linking. I do not know if this is related to the Snitun thing but I thought I would mention it

What is snitun server?

Hi I have this same issue but now i know it’s not just me i can ignore it and leave it to those who have the knowledge to fix it.
Also i have the following warning that generates a notification

Logger: homeassistant.components.http.ban
Source: components/http/ban.py:124
Integration: HTTP (documentation, issues)
First occurred: 17:10:00 (7 occurrences)
Last logged: 17:36:07

Login attempt or request with invalid authentication from Blacknight ().
(Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36)

and it’s constantly repeating and a pain in the butt, anyone know why because i sure don’t.

Connection problem to snitun server
14:21:10 – (ERROR) /usr/local/lib/python3.9/site-packages/hass_nabucasa/remote.py
Challenge/Response error with SniTun server
14:21:10 – (ERROR) /usr/local/lib/python3.9/site-packages/snitun/client/client_peer.py

Same thing, after an HA restart. Had to log out of Nabu Casa and log in again.

2021-11-18 19:34:19 ERROR (MainThread) [snitun.client.client_peer] Challenge/Response error with SniTun server

2021-11-18 19:34:19 ERROR (MainThread) [hass_nabucasa.remote] Connection problem to snitun server

2021-11-19 19:24:42 ERROR (MainThread) [snitun.multiplexer.core] Ping fails, no response from peer

2021-11-20 11:32:16 ERROR (MainThread) [snitun.client.connector] Can’t connect to endpoint 127.0.0.1:56723

2021-11-20 11:32:26 ERROR (MainThread) [snitun.client.connector] Can’t connect to endpoint 127.0.0.1:56723

2021-11-20 11:32:36 ERROR (MainThread) [snitun.client.connector] Can’t connect to endpoint 127.0.0.1:56723

2021-11-20 11:32:42 ERROR (MainThread) [snitun.client.connector] Can’t connect to endpoint 127.0.0.1:56723

2021-11-20 11:32:42 ERROR (MainThread) [snitun.client.connector] Can’t connect to endpoint 127.0.0.1:56723

… and lots more of the above…

the same for me:

Logger: snitun.client.client_peer
Source: /usr/local/lib/python3.9/site-packages/snitun/client/client_peer.py:104
First occurred: 16:34:50 (2 occurrences)
Last logged: 16:34:58

Challenge/Response error with SniTun server (0 bytes read on a total of 32 expected bytes)

and

Logger: hass_nabucasa.remote
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/remote.py:333
First occurred: 16:34:50 (2 occurrences)
Last logged: 16:34:58

Connection problem to snitun server

Frank

I´m also having this problem.
I don´t know with it´s related or not, but my connection betwenn HA and Alexa using Nabu casa just drops after few minutes.
I can control the devices trough alexa but after few minutes, less than five, I just get the “device not responding” answer from alexa.
Does anyone facing the same issue? Can someone please help me?!

Is there some progress here?
I still have :
2022-03-10 16:10:44 ERROR (MainThread) [snitun.client.client_peer] Challenge/Response error with SniTun server (0 bytes read on a total of 32 expected bytes)
2022-03-10 16:10:44 ERROR (MainThread) [hass_nabucasa.remote] Connection problem to snitun server
I have 2022-03-10 16:10:44 ERROR (MainThread) [snitun.client.client_peer] Challenge/Response error with SniTun server (0 bytes read on a total of 32 expected bytes)
2022-03-10 16:10:44 ERROR (MainThread) [hass_nabucasa.remote] Connection problem to snitun server

Some help would be nice. I know from searching this problem has been going on for awhile. And most have the errors during startup. I don’t now. In the last 5 hours I’ve had one of the errors 175 times. I travel and have to be able to remote in to HA. I’ve been trying the last few night to remote in to work on the system and have not been able to because I keep losing connection. Here are some of the errors.

Logger: hass_nabucasa.remote
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/remote.py:333
First occurred: 5:40:24 PM (175 occurrences)
Last logged: 10:25:01 PM

Connection problem to snitun server
Logger: snitun.client.client_peer
Source: /usr/local/lib/python3.9/site-packages/snitun/client/client_peer.py:104
First occurred: 5:40:31 PM (174 occurrences)
Last logged: 10:25:01 PM

Challenge/Response error with SniTun server (0 bytes read on a total of 32 expected bytes)
Challenge/Response error with SniTun server ([Errno 104] Connection reset by peer)
Logger: snitun.multiplexer.core
Source: /usr/local/lib/python3.9/site-packages/snitun/multiplexer/core.py:111
First occurred: 6:05:16 PM (49 occurrences)
Last logged: 10:24:31 PM

Ping fails, no response from peer
Logger: hass_nabucasa.iot
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/iot_base.py:126
First occurred: 7:43:55 PM (5 occurrences)
Last logged: 10:12:53 PM

Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python3.9/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.9/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.9/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python3.9/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.9/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.9/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/hass_nabucasa/iot_base.py", line 122, in connect
    await self._handle_connection()
  File "/usr/local/lib/python3.9/site-packages/hass_nabucasa/iot_base.py", line 164, in _handle_connection
    await self.cloud.auth.async_check_token()
  File "/usr/local/lib/python3.9/site-packages/hass_nabucasa/auth.py", line 184, in async_check_token
    await self._async_renew_access_token()
  File "/usr/local/lib/python3.9/site-packages/hass_nabucasa/auth.py", line 211, in _async_renew_access_token
    await self.cloud.run_executor(cognito.renew_access_token)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 648, in renew_access_token
    self._set_tokens(refresh_response)
  File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 720, in _set_tokens
    self.verify_token(tokens["AuthenticationResult"]["IdToken"], "id_token", "id")
  File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 239, in verify_token
    hmac_key = self.get_key(kid)
  File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 221, in get_key
    keys = self.get_keys().get("keys")
  File "/usr/local/lib/python3.9/site-packages/pycognito/__init__.py", line 215, in get_keys
    self.pool_jwk = requests.get(
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Logger: hass_nabucasa.iot
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/iot_base.py:166
First occurred: 10:11:32 PM (1 occurrences)
Last logged: 10:11:32 PM

Cannot connect because unable to refresh token:
Logger: hass_nabucasa.remote
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/remote.py:331
First occurred: 7:07:55 PM (12 occurrences)
Last logged: 10:06:04 PM

Timeout connecting to snitun server
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/http.py:253
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 6:22:10 PM (6 occurrences)
Last logged: 10:03:36 PM

[547542929712] Disconnected: Did not receive auth message within 10 seconds
[547541885664] Disconnected: Did not receive auth message within 10 seconds
[547543462144] Disconnected: Did not receive auth message within 10 seconds
[547493343136] Disconnected: Did not receive auth message within 10 seconds
[547599942848] Disconnected: Did not receive auth message within 10 seconds
Logger: hass_nabucasa.iot
Source: /usr/local/lib/python3.9/site-packages/hass_nabucasa/iot_base.py:264
First occurred: 7:53:05 PM (7 occurrences)
Last logged: 9:35:13 PM

Unable to connect: Cannot connect to host cloud.nabucasa.com:443 ssl:default [None]
1 Like

I have been sudenly getting timeouts for my calls to the Home Assistant REST Api via Nabu Casa Cloud and have the same errors, where there were none before

2023-03-16 08:59:59.588 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from fded:45a8:8b70:1:4bf:c798:b872:29ea (fded:45a8:8b70:1:4bf:c798:b872:29ea). Requested URL: '/auth/login_flow/53169953262b6a2a956cc9bdc2e0f3a6'. (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36)
2023-03-16 09:09:48.317 ERROR (MainThread) [snitun.client.client_peer] Challenge/Response timeout error to SniTun server
2023-03-16 09:09:48.323 ERROR (MainThread) [hass_nabucasa.remote] Connection problem to snitun server
2023-03-16 09:12:47.862 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /homeassistant/restart request