Timeout while contacting DNS servers

Hi,

I have been getting this error in my logs multiple times/day recently and have no clue what’s causing it.
Sometimes it’s an issue with hacs.zyz, sometimes registry.hub.docker.com and sometimes others integration websites.

I haven’t knowingly changed any network settings, but it feels like it started with 2025.5

I’m running g HA Container 2025.5.2 (Docker) on a Pi4.

Any suggestions for me to try out?

2 Likes

What DNS servers are you using ?

I have been getting the same errors in my container setup on my Pi from various integrations. It is only intermittently and not directly at startup.

I also run Tailscale, which runs a small DNS, and Pihole but I have turned both off (turned off Tailscale and manually put my router as DNS server on the host Pi) and it occured again.

If I execute nslookup or dig in the container I get no errors and my other containers also run fine so I suspect it is something in Home Assistant.

This or a similar line has popped up in the log:
aiodns.error.DNSError: (12, ‘Timeout while contacting DNS servers’)

aiodns was updated in 2025.5 and again in 2025.5.1.

How could I further diagnose this to find out if it some obscure bug (since this is the first I have seen another user report something similar) or a bad configuration in my setup?

I’m having a similar issue where a notifications sent by automations in the morning fails (Timeout while contacting DNS servers), but when testing manually it works fine.

DNS queries goes via a pi-hole to quad9. I think the log from pi-hole looks strange (see below), but I can’t tell if the problem is with HA, pi-hole or upstream.

Two notifications are supposed to be sent at 6:20, and one at 7:00, but they all fail. Later dig mobile-apps.home-assistant.io from HA works fine.

I also think it started with 2025.5.


2025-05-25 07:00:02.009 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Error sending notification to https://mobile-apps.home-assistant.io/api/sendPush/android/v1: ClientConnectorDNSError(ConnectionKey(host='mobile-apps.home-assistant.io', port=443, is_ssl=True, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None), OSError(None, 'Timeout while contacting DNS servers'))
Query Received On Type Domain Client Response Time Query Status Reply
2025-05-25 11:03:17.685 A mobile-apps.home-assistant.io homeassistant.home 61.8 µs Served from cache IP
2025-05-25 11:03:11.687 A mobile-apps.home-assistant.io homeassistant.home 23.4 µs Served from cache IP
2025-05-25 11:02:14.832 A mobile-apps.home-assistant.io homeassistant.home 14.9 ms Forwarded, reply from 149.112.112.10#53 IP
2025-05-25 07:00:06.695 A mobile-apps.home-assistant.io homeassistant.home 8.8 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.695 AAAA mobile-apps.home-assistant.io homeassistant.home 6.0 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.695 A mobile-apps.home-assistant.io homeassistant.home 8.1 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.694 A mobile-apps.home-assistant.io homeassistant.home 4.5 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.694 AAAA mobile-apps.home-assistant.io homeassistant.home 24.8 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.694 A mobile-apps.home-assistant.io homeassistant.home 7.6 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.694 AAAA mobile-apps.home-assistant.io homeassistant.home 8.3 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.693 A mobile-apps.home-assistant.io homeassistant.home 17.9 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.693 AAAA mobile-apps.home-assistant.io homeassistant.home 5.2 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.693 AAAA mobile-apps.home-assistant.io homeassistant.home 7.4 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.693 A mobile-apps.home-assistant.io homeassistant.home 4.8 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.692 A mobile-apps.home-assistant.io homeassistant.home 20.0 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.692 AAAA mobile-apps.home-assistant.io homeassistant.home 4.3 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.692 AAAA mobile-apps.home-assistant.io homeassistant.home 4.5 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.691 A mobile-apps.home-assistant.io homeassistant.home 4.8 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.691 A mobile-apps.home-assistant.io homeassistant.home 20.0 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.691 AAAA mobile-apps.home-assistant.io homeassistant.home 5.5 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.691 AAAA mobile-apps.home-assistant.io homeassistant.home 5.0 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.691 A mobile-apps.home-assistant.io homeassistant.home 18.8 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.684 A mobile-apps.home-assistant.io homeassistant.home 8.1 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.684 AAAA mobile-apps.home-assistant.io homeassistant.home 5.2 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.684 A mobile-apps.home-assistant.io homeassistant.home 5.7 µs Already forwarded, awaiting reply IP
2025-05-25 07:00:06.683 AAAA mobile-apps.home-assistant.io homeassistant.home 7.6 µs Served by cache optimizer NODATA
2025-05-25 07:00:06.683 A mobile-apps.home-assistant.io homeassistant.home 23.6 µs Served by cache optimizer IP
2025-05-25 07:00:06.682 AAAA mobile-apps.home-assistant.io homeassistant.home 18.8 µs Retried NODATA
2025-05-25 06:20:06.528 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.528 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.527 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.527 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.527 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.527 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.526 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.525 A mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.525 AAAA mobile-apps.home-assistant.io homeassistant.home Already forwarded, awaiting reply No reply received
2025-05-25 06:20:06.525 AAAA mobile-apps.home-assistant.io homeassistant.home 48.4 ms Forwarded, reply from 9.9.9.10#53 NODATA
2025-05-25 06:20:06.524 A mobile-apps.home-assistant.io homeassistant.home 19.1 ms Forwarded, reply from 9.9.9.10#53 IP

Hi,

Not sure. My Mac just gives my router’s address and I cannot find it specced in my router’s settings.

Needles to say, it hasn’t changed though.


Edit: So my router is either ‘automatic’ (but unknown) or manual. I have therefore just set it to manual and 9.9.9.9 (Quad9) …but this shouldn’t make any difference as nothing had changed, should it?

I’m using the docker version of Home Assistant and can definitely say this has something to with the aiodns library. I experienced this live and immediately checked the host and the container. Both were perfectly able to resolve any DNS query that was failing for all kinds of integrations, but HA couldn’t resolve them.

I think this behavior started with version 2025.5, but definitely experience it in .1, .2 and .3

1 Like

I’ve created an issue on GitHub

I experience the same behaviour with the Docker container deployed. No issues in the 2025.4.x.

I have this issue, too. I first noticed it a week or so ago, when certain automations stopped running. When I looked in the logs, I found a bunch of errors that contained the line, [Timeout while contacting DNS servers]. These corresponded to the failures exactly. I don’t know exactly when it started, as I’ve been traveling a good deal, but I’m pretty sure there were no issues prior to 2025.5.

I have two PiHoles running in my home. I’ve run some tests, and there’s no issue with them; every other device in the house connects perfectly, with no timeouts. Nevertheless, to remove any possibility that they might be the problem, I changed the DNS servers in Home Assistant to Google (8.8.8.8., 8.8.4.4.). That didn’t help. Neither did using Cloudflare (1.1.1.1., 1.0.0.1.). I also tried combining my two local DNS servers, with an external service (such as Google or Cloudlfare), but this made no difference.

Both external and internal DNS entries are affected by this issue. Strangely, from what I can tell, the timeout error only seems to happen when the task being run is automated. If I run an action manually, it works every time. (Or, at least, every time I’ve tried.)

If it helps, I’m running a Raspberry Pi 4. Here are my versions:

  • Installation method: Home Assistant OS
  • Core: 2025.5.3
  • Supervisor: 2025.05.3
  • Operating System:15.2
  • Frontend: 20250516.0

I’m running HA Container (docker) on a PI.

Just downgraded to 2025.4.4 and can confirm the problem doesn’t exist pre 2025.5.

The Version integration produces the error even it is manually reloaded.

I’m just commenting to continue to bring visibility to this. I’m running HAOS in a VM on Proxmox. This issue started with 2025.5.0 and continues through patch updates.

FWIW, I am using two instances of pi-hole with local unbound for upstream. Since I started having this issue, I added 1.1.1.1 and 9.9.9.9 as additional DNS servers in HAOS networks settings and it has not made any difference.

I’ve been seeing something similar. First noticed it about a month ago, in all likelihood after I ran an update. I run hass.io on a Raspi3 connected via wifi to an Asus router. The DNS server settings on my router point to Google - 8.8.8.8 and 8.8.4.4.

For the past month or so it’s been dropping off the network after 36 to 48 hours. A hard reboot will usually fix it temporarily, but occasionally it still doesn’t work after a reboot either.

I managed to trap the errors in the logs today to see what’s going on and sure enough it’s DNS resolution that’s failing and timing out.

the Gitbub issue hasn’t gotten traction with any devs so not sure where to go from here.

I’ve stumbled over this topic because I had the same problem after upgrading from 2025.4 to 2025.5.3.

I’m runnig HA on a QNAP Container and the problem was not there before and only some integrations had it.

I was able to solve it by adding an external DNS server (8.8.8.8 in my case) to the

/etc/resolv.conf

within the container.

Background:

Per default the container uses the docker internal resolver (127.0.0.11) which then forwards the DNS request to the DNS server configured in docker/on the host system. The problem is that this internal resolver sometimes has performance issues and does not respond fast enough - which results in timeouts. However this does not affect tools like dig, ping, nslookup as they are more tolerant, but it seems that some extensions using Python internal resolving libraries are more vulnerable to timeouts.

1 Like

127.0.0.1 ?

Why do you think it got worse in 2025.5 though?

I run in docker on a Pi and will try your fix. It only lasts as long as the container runs (will lose it on a restart) though, right?

No it is actually really 127.0.0.11, not the .1. It’s not running as loopback inside the container but its a docker internal service which ich listening on the .11

I have no idea why it got worse in 2025.5. Maybe because of some library changes? I did not change anything in the underling OS & Docker installation so the reason needs to be inside the HA container.

On the restart, … it will survive a restart but not a rebuild of the container. My container is build manually so that is a workaround which currenty is ok for me but if you re/start the container with compose that will not survive.

There is a parameter to set the DNS in the docker run/compose.yaml but currently my installation was ignoring this so I had to revert to manual file editing.

1 Like

Got it - thanks.

Yes, I meant that but worded it badly.

Could you share that - I’d like to try it and can’t see it in the HA docs.

edit: is it literally:

  dns:
      - 8.8.8.8

Yes and for docker run it is “–dns=8.8.8.8” but my container does ignore this parameter for whatever reason.

pretty sure it is ignoring it for me as I ran into a host of issues (no pun intended) when I tried it.