projectdiscovery/nuclei · error

Invalid DNS request type: %s

Error message

Invalid DNS request type: %s

What it means

Raised by toDNSRequestTypes when a DNS template request's type field, after TrimSpace + ToUpper, matches none of DNSRequestTypeMapping (dns_types.go:56-75). Supported types are A, NS, DS, CNAME, SOA, PTR, MX, TXT, AAAA, CAA, TLSA, ANY, SRV, RRSIG, NSEC, DNSKEY, NSEC3, NSEC3PARAM. DNSRequestTypeHolder.UnmarshalYAML propagates the error and template compilation stops.

Source

Thrown at pkg/protocols/dns/dns_types.go:93

}

// GetSupportedDNSRequestTypes returns list of supported types
func GetSupportedDNSRequestTypes() []DNSRequestType {
	var result []DNSRequestType
	for index := DNSRequestType(1); index < limit; index++ {
		result = append(result, index)
	}
	return result
}

func toDNSRequestTypes(valueToMap string) (DNSRequestType, error) {
	normalizedValue := normalizeValue(valueToMap)
	for key, currentValue := range DNSRequestTypeMapping {
		if normalizedValue == currentValue {
			return key, nil
		}
	}
	return -1, errors.New("Invalid DNS request type: " + valueToMap)
}

func normalizeValue(value string) string {
	return strings.TrimSpace(strings.ToUpper(value))
}

func (t DNSRequestType) String() string {
	return DNSRequestTypeMapping[t]
}

// DNSRequestTypeHolder is used to hold internal type of the DNS type
type DNSRequestTypeHolder struct {
	DNSRequestType DNSRequestType `mapping:"true"`
}

func (holder DNSRequestTypeHolder) String() string {
	return holder.DNSRequestType.String()
}

View on GitHub (pinned to 265b3a3dec)

Solutions

  1. Use one of the supported types, e.g. A, AAAA, CNAME, MX, TXT, SOA, NS, PTR, SRV, CAA, TLSA, DS, ANY, RRSIG, NSEC, DNSKEY, NSEC3, NSEC3PARAM
  2. Check the type is spelled as a bare record name without extra words
  3. Validate DNS templates with nuclei -validate before running

Example fix

# before
dns:
  - type: AXFR
    name: '{{FQDN}}'
# after
dns:
  - type: NS
    name: '{{FQDN}}'
Defensive patterns

Strategy: validation

Validate before calling

var validDNSTypes = map[string]bool{}
for _, t := range dns.GetSupportedDNSRequestTypes() { validDNSTypes[t.String()] = true }
func dnsTypeOK(s string) bool { return validDNSTypes[strings.ToUpper(strings.TrimSpace(s))] }

Prevention

When it happens

Trigger: A dns request block with type: AXFR, type: mx (fine after uppercasing) but type: mail fails; any record type outside the eighteen supported values.

Common situations: Requesting zone-transfer (AXFR) or obscure record types nuclei does not enumerate; lowercase/mixed-case works, but abbreviations and wrong names (e.g. 'txt-record') do not.

Related errors


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/4db8f10cf263e218. Report an issue: GitHub.