·5 min read
When a 404 does not mean the domain is free
A domain checker has one job that cannot go wrong in one direction: it must never say "available" about a name you cannot buy. In DomainHunter, the first source I ask is RDAP, and RDAP speaks in HTTP status codes. A 200 means the name is registered. A 404 means there is no such object, which for a domain means it is free. It is a clean, tempting rule, and for some extensions it is a lie.
- Project
- DomainHunter
- Date
- Sep 2026
- Stack
- Python, requests, RDAP
- Commit
- 8c24558
I should say how I know this. The repository has a single commit, 8c24558 (Sep 2026), the whole first release at once, so there is no history of me discovering the problem. What follows is told from the code, its comments and the README, which all agree on the rule.
What broke
DomainHunter does not ask each registry directly, because it would first have to know which registry serves which extension. It uses rdap.org, a public bootstrap service. You request https://rdap.org/domain/example.com and it redirects you to the RDAP server that is responsible for .com. The HTTP client follows the redirect, and you read the registry's answer.
That works for extensions that publish an RDAP server. For the ones that do not, there is nowhere to redirect to. The module docstring names them: "a number of ccTLDs (.io, .gg, ...) publish no RDAP server". For those, rdap.org has no registry to send you to, and it answers 404 itself.
Now compare the two situations from the point of view of a client that only reads the final status code:
- A name that is really free, on an extension with RDAP: the registry says 404, no such object.
- Any name at all, on an extension without RDAP:
rdap.orgsays 404.
They look identical. A tool that treats every 404 as "free" would tell you that any .io name is available, and it would say so with the confidence of an authoritative source. This is the worst bug a checker can have, because it fails silently and always in the optimistic direction.
What the code showed
The fix is in availability.py, and the comment above it states the reasoning in full:
# rdap.org 404s without redirecting when the TLD has no RDAP server at
# all. A genuine "this name is free" answer always comes from the
# registry's own host, so require that the redirect happened.
redirected = "rdap.org" not in r.url.split("/")[2]r.url is the URL of the final response after requests followed any redirects. Splitting it on / and taking index 2 gives the host: https://host/path splits into https:, an empty string, then host. If the host is still rdap.org, nobody redirected us. The answer came from the bootstrap itself, and it carries no information about the domain.
Then the status codes are interpreted with that in mind:
if r.status_code == 200:
return Result(domain, TAKEN, "rdap", "registered")
if r.status_code == 404 and redirected:
return Result(domain, FREE, "rdap", "no such object")
if r.status_code == 404:
return Result(domain, UNKNOWN, "rdap", "tld has no rdap server")
return Result(domain, UNKNOWN, "rdap", f"http {r.status_code}")A 200 is safe either way: only a registry would return a domain record. A 404 is only evidence when a registry sent it. Everything else is unknown, which is a real value in the tool and not an error. The README repeats the rule in its own words: a 404 only counts as available when the bootstrap actually redirected to a registry host.
The fix
There is no before and after commit to cite, so I will be plain about it: the guard shipped with the tool in 8c24558. What I can show is the consequence in the code path. The check method asks RDAP first, and returns immediately only if the status is not unknown. An RDAP unknown therefore hands the name to WHOIS, and after that to DNS. For an extension like .io, the name is not marked free on the strength of a bootstrap 404. It gets checked by a source that can actually answer.
The unknown result also keeps its reason. Result carries a detail string, so the output can say "tld has no rdap server" rather than a bare unknown, and the table shows which source produced each answer.
What I would do differently
The check is a string test on a hostname: "rdap.org" not in host. It works, but it is a convention I inferred from how the service behaves, written with a comment and not a test. I would add a unit test that feeds the function a fake 404 with each URL shape and asserts the three outcomes, so the rule survives a refactor.
I would also record the list of known no-RDAP extensions only in a test fixture and not in a docstring comment. The docstring currently names .io and .gg and says the module has two sources, while the code has three. The docstring is stale, since the code has a DNS source too. Comments are the first thing to drift.
And one assumption stays open. A registry's own 404 is treated as proof of "free". That is what RDAP specifies for a missing object, but I did not run the tool against live registries for this post, and I would not claim every registry follows it.
Where this fits
This guard is one of several in DomainHunter that make "unknown" an honest answer instead of a guess. The full DomainHunter case study covers the other sources, the pricing and ranking, and the Windows build.
Open `availability.py` and read the `rdap` method next to the README's caveat, which says the same thing in prose.
View the code on GitHub#python#rdap#domains#http#debugging
Keep reading
Have a project in mind?