Consul Returns Incorrect Nodes when a Queried Node Doesn't Exist (Short Node Names)
Author: SilvengaCreated Jul 9, 2026Updated Aug 29, 2026
Overview of the Issue
Consul DNS can return random nodes when a short node name doesn't exist.
This is directly related to this code:
Which originates from this commit:
https://github.com/hashicorp/consul/commit/fe49c0a0abe8d0779abfca0bc13ad557173f664d
I'm torn on this. It's useful from a UX perspective for an operator to be able to type in something that's short. At the same time, by enforcing an
8character length, we reduced the probability of a user depending on the behavior and having it suddenly stop working in the future when a duplicate prefix is injected into the environment.
I was very surprised. From what I can tell, there is no way for an operator to op-out of this behavior.
Reproduction Steps
- Run a cluster.
- Use short 3 character host names for nodes, like
ba1(really node names that also happen to be hex). - Get unlucky (a UUID just happens to start with that node name being queried), so in this case, have a node randomly generate a UUID that starts with
BA1....
Source: hashicorp/consul