coredns/coredns · error

multiple 'dns' query values found

Error message

multiple 'dns' query values found

What it means

Validation error in requestToMsgGet. The 'dns' query parameter appears more than once in the request URL, making the DNS message to decode ambiguous; the DoH GET handler rejects the request rather than guessing which value to use.

Source

Thrown at plugin/pkg/doh/doh.go:132

	if err != nil {
		return nil, nil, err
	}
	m, err := dnsutil.UnpackRequest(buf)
	return m, buf, err
}

const maxDNSQuerySize = 65536
const maxBase64Len = (maxDNSQuerySize*8 + 5) / 6

// requestToMsgGet extract the dns message from the GET request.
func requestToMsgGet(req *http.Request) (*dns.Msg, []byte, error) {
	values := req.URL.Query()
	b64, ok := values["dns"]
	if !ok {
		return nil, nil, fmt.Errorf("no 'dns' query parameter found")
	}
	if len(b64) != 1 {
		return nil, nil, fmt.Errorf("multiple 'dns' query values found")
	}
	if len(b64[0]) > maxBase64Len {
		return nil, nil, fmt.Errorf("dns query too large")
	}
	return base64ToMsgWire(b64[0])
}

func toMsg(r io.ReadCloser) (*dns.Msg, error) {
	m, _, err := toMsgWire(r)
	return m, err
}

func toMsgWire(r io.ReadCloser) (*dns.Msg, []byte, error) {
	buf, err := io.ReadAll(http.MaxBytesReader(nil, r, maxDNSQuerySize))
	if err != nil {
		return nil, nil, err
	}
	m := new(dns.Msg)

View on GitHub (pinned to 558c9757a9)

Solutions

  1. Send only one 'dns' query parameter per GET request as required by RFC 8484
  2. Remove duplicated or accidental extra 'dns' parameters from the client's URL construction
  3. If parameters may repeat, deduplicate them before sending
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugin/pkg/doh/doh.go:132 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coredns/coredns@558c9757a9 (2026-09-06). Data as JSON: /api/errors/53e93e7d633a5803. Report an issue: GitHub.