{"record":{"id":"4db8f10cf263e218","repo":"projectdiscovery/nuclei","slug":"invalid-dns-request-type-s","errorCode":null,"errorMessage":"Invalid DNS request type: %s","messagePattern":"Invalid DNS request type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/dns/dns_types.go","lineNumber":93,"sourceCode":"}\n\n// GetSupportedDNSRequestTypes returns list of supported types\nfunc GetSupportedDNSRequestTypes() []DNSRequestType {\n\tvar result []DNSRequestType\n\tfor index := DNSRequestType(1); index < limit; index++ {\n\t\tresult = append(result, index)\n\t}\n\treturn result\n}\n\nfunc toDNSRequestTypes(valueToMap string) (DNSRequestType, error) {\n\tnormalizedValue := normalizeValue(valueToMap)\n\tfor key, currentValue := range DNSRequestTypeMapping {\n\t\tif normalizedValue == currentValue {\n\t\t\treturn key, nil\n\t\t}\n\t}\n\treturn -1, errors.New(\"Invalid DNS request type: \" + valueToMap)\n}\n\nfunc normalizeValue(value string) string {\n\treturn strings.TrimSpace(strings.ToUpper(value))\n}\n\nfunc (t DNSRequestType) String() string {\n\treturn DNSRequestTypeMapping[t]\n}\n\n// DNSRequestTypeHolder is used to hold internal type of the DNS type\ntype DNSRequestTypeHolder struct {\n\tDNSRequestType DNSRequestType `mapping:\"true\"`\n}\n\nfunc (holder DNSRequestTypeHolder) String() string {\n\treturn holder.DNSRequestType.String()\n}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/dns/dns_types.go#L75-L111","documentation":"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.","triggerScenarios":"A dns request block with type: AXFR, type: mx (fine after uppercasing) but type: mail fails; any record type outside the eighteen supported values.","commonSituations":"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.","solutions":["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","Check the type is spelled as a bare record name without extra words","Validate DNS templates with nuclei -validate before running"],"exampleFix":"# before\ndns:\n  - type: AXFR\n    name: '{{FQDN}}'\n# after\ndns:\n  - type: NS\n    name: '{{FQDN}}'","handlingStrategy":"validation","validationCode":"var validDNSTypes = map[string]bool{}\nfor _, t := range dns.GetSupportedDNSRequestTypes() { validDNSTypes[t.String()] = true }\nfunc dnsTypeOK(s string) bool { return validDNSTypes[strings.ToUpper(strings.TrimSpace(s))] }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint DNS templates against the eighteen supported record types","Use the bare record name (TXT, not txt-record)","Run nuclei -validate before adding templates to a pack"],"tags":["dns","template","yaml","validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}