---
title: "Temporary failure in name resolution or name not known? | Proofline"
description: "On Linux with glibc, \"Temporary failure in name resolution\" means no usable answer came back."
url: https://proofline.sh/learn/getaddrinfo-temporary-failure-name-resolution/
---

[Learning center](/learn/)

# Temporary failure in name resolution or name not known?

On Linux with glibc, "Temporary failure in name resolution" means no usable answer came back. "Name or service not known" means an answer said the name does not exist. The first points at the resolver or the path to it; the second points at the name, the record or the search list. Reproduce the lookup with getent ahosts on the same host before you reach for dig, because only getent follows the same path as the application.

Network outages The Proofline team November 23, 2026 6 min read

## Two messages, two error codes

Most runtimes on Linux resolve names through the C library's `getaddrinfo`. When it fails, it returns an `EAI_*` code, and `gai_strerror` turns that code into the text you see in logs. glibc's table maps them like this: [glibc gai\_strerror strings](https://github.com/bminor/glibc/blob/master/sysdeps/posix/gai_strerror-strs.h) · [getaddrinfo(3)](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html)

| Code | Message | getaddrinfo(3) says |
| --- | --- | --- |
| `EAI_AGAIN` | Temporary failure in name resolution | The name server returned a temporary failure indication |
| `EAI_NONAME` | Name or service not known | The node or service is not known |
| `EAI_FAIL` | Non-recoverable failure in name resolution | The name server returned a permanent failure indication |
| `EAI_NODATA` | No address associated with hostname | The host exists but has no network addresses defined |

The glibc source shows what produces the first two. A DNS response with RCODE SERVFAIL sets the resolver's `TRY_AGAIN` status, and `getaddrinfo` turns `TRY_AGAIN` into `EAI_AGAIN`. When both the IPv4 and IPv6 queries time out, it also reports `EAI_AGAIN`. An NXDOMAIN response ends as `EAI_NONAME`. [glibc res\_query.c](https://github.com/bminor/glibc/blob/master/resolv/res_query.c) · [glibc getaddrinfo.c](https://github.com/bminor/glibc/blob/master/nss/getaddrinfo.c)

So the two messages separate a missing answer from a negative one:

-   `EAI_AGAIN`: a resolver replied SERVFAIL, or no resolver replied in time. Look at the resolver, its upstream, DNSSEC, and the network between the client and the resolver.
-   `EAI_NONAME`: a source answered that the name does not exist. Look at the record, the zone the resolver consulted, and which name the client actually asked for.

Other runtimes may not use glibc at all. Go's pure resolver sends DNS queries itself, reading `/etc/resolv.conf`, and is preferred on Unix unless cgo conditions apply, so a Go service does not print these glibc strings. Images built on musl also have their own resolver. [Go net package: name resolution](https://pkg.go.dev/net)

## Why a temporary failure can take seconds

`/etc/resolv.conf` sets how long each attempt waits and how many times the library tries. The defaults in glibc are `timeout:5` seconds and `attempts:2`, with up to three `nameserver` lines tried in order. The man page notes that the timeout is per attempt and is not necessarily the total time of one call. A search list multiplies this: a name with fewer dots than `ndots` is tried with each search domain in turn, and every one of those queries can time out. [resolv.conf(5)](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)

A request that fails after 10 or 20 seconds with `EAI_AGAIN` is a strong hint that the queries went unanswered. A request that fails in milliseconds with the same message more likely got a SERVFAIL. [Search lists in Kubernetes](/learn/kubernetes-ndots-external-lookups/)

## Reproduce the application's lookup

`getent ahosts NAME` passes the name to `getaddrinfo` with `AF_UNSPEC` and prints each address, so it uses the same `/etc/nsswitch.conf`, `/etc/hosts`, search list and resolver as a glibc application in that container. `getent hosts` uses the older `gethostbyname2` path, which is close but not identical. dig ignores all of that and asks one DNS server directly. [getent(1)](https://man7.org/linux/man-pages/man1/getent.1.html) · [nsswitch.conf(5)](https://man7.org/linux/man-pages/man5/nsswitch.conf.5.html)

```
# Inside the failing container or on the failing host
cat /etc/resolv.conf
grep '^hosts' /etc/nsswitch.conf
time getent ahosts NAME

# Then ask each configured name server directly
dig @NAMESERVER_1 NAME A +tries=1 +timeout=2
dig @NAMESERVER_1 NAME.SEARCH_DOMAIN A +tries=1 +timeout=2
```

The `hosts:` line in `nsswitch.conf` lists the sources in order, for example `files dns`. A name pinned in `/etc/hosts` never reaches DNS, and a name missing from DNS can still resolve from the file. If the line names something other than `files` and `dns`, such as a local caching service, include it in your checks.

On Kubernetes or ECS, run these through `kubectl exec` or ECS Exec in the failing container. A debug container on the same node uses the node's configuration, not the pod's. [Exec into an ECS task](/learn/dependency-timeouts-only-from-new-tasks/#same-connection)

## Read the result

| getent ahosts | dig to the name server | Points to |
| --- | --- | --- |
| Slow, then nothing | No reply | Path to the resolver, or the resolver is down or throttling |
| Fast, nothing | SERVFAIL | Resolver's upstream or DNSSEC validation |
| Nothing | NXDOMAIN for every search variant | The record or the name |
| Address | Address | Intermittent fault; repeat over the failure window |
| Address | NXDOMAIN | `/etc/hosts` or another nsswitch source supplies it |

For the meaning of each DNS reply, and how to compare the resolver with the authoritative server, see [NXDOMAIN, SERVFAIL or no answer](/learn/dns-nxdomain-servfail-timeout/).

## A worked example: one service, two messages

This example is illustrative. The `orders` service runs in containers whose `resolv.conf` lists one name server, 10.0.0.2, with default options.

From 11:05 UTC, a share of requests to `payments.example.internal` fail after about ten seconds with `Temporary failure in name resolution`. `time getent ahosts payments.example.internal` in an affected container takes 10.0 seconds and prints nothing; a second run returns 10.0.12.7 at once. `dig @10.0.0.2 payments.example.internal +tries=1 +timeout=2` times out roughly one time in five. Two attempts of five seconds each, then the failure: the queries were lost on the way to or from the resolver. The record is fine. The next step is the resolver's capacity and the network path, such as a per-interface packet limit. [VPC resolver packet limit](/learn/aws-vpc-resolver-packet-limit/)

In a second incident, every request to `ledger.example.internal` fails at once with `Name or service not known`. `getent ahosts` returns nothing in 4 milliseconds, and dig shows NXDOMAIN for the name and for each search-domain variant, with the SOA of `example.internal` in the authority section. The resolver is answering promptly; the zone has no such record. A deploy at 10:58 changed the hostname in configuration from `ledgers` to `ledger`. Fix the configuration, not DNS.

## Limits

The mapping above is glibc's. musl, Go's pure resolver, the JVM and systemd-resolved stubs report failures in their own words, and some collapse several causes into one. Read the library you actually run before you lean on the message.

`getent` reproduces the system lookup, not caches inside the application. A JVM or a connection pool may hold an old answer or an old negative answer for its own TTL. [Clients that keep an old address](/learn/dns-client-caches-old-address-after-failover/)

A single run rarely catches an intermittent fault. Loop the lookup over the failure window and count failures and their durations. For the method across all dependency layers, start at [runtime dependency failures](/learn/runtime-dependency-failures/).

## Questions

### What does "Temporary failure in name resolution" mean?

It is glibc's message for `EAI_AGAIN`. A resolver returned SERVFAIL, or every query timed out. It does not say the name is missing; look at the resolver and the path to it.

### Why does nslookup work when the application cannot resolve the name?

nslookup and dig speak DNS directly to a server and ignore `/etc/nsswitch.conf` and `/etc/hosts`. They may also run on a different host with a different resolver. Use `getent ahosts` inside the application's container to follow its path.

### Is "Name or service not known" ever caused by the port?

It can be. `EAI_NONAME` also covers a service name that is not known, so a lookup with a misspelled service name in place of a numeric port fails the same way. Check that the port in configuration is a number.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [DNS lookup failed: NXDOMAIN, SERVFAIL, NODATA or no answer?](/learn/dns-nxdomain-servfail-timeout/)
    
    Network outages The Proofline team November 23, 2026 6 min read
    
-   ### [Why one external lookup from a Kubernetes pod sends many queries](/learn/kubernetes-ndots-external-lookups/)
    
    Network outages The Proofline team November 23, 2026 6 min read
