#23724·consul

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:

https://github.com/hashicorp/consul/blob/7d6316305e8612066e0a23c7a1209e7dae5e7441/agent/consul/state/catalog.go#L38-L43

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 8 character 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

  1. Run a cluster.
  2. Use short 3 character host names for nodes, like ba1 (really node names that also happen to be hex).
  3. 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....