{"record":{"id":"82be828da15e82c3","repo":"projectdiscovery/nuclei","slug":"invalid-dns-type","errorCode":null,"errorMessage":"invalid dns type","messagePattern":"invalid dns type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/operators/common/dsl/dsl.go","lineNumber":61,"sourceCode":"\t\t\tdnsType = dns.TypeAAAA\n\t\tcase \"cname\":\n\t\t\tdnsType = dns.TypeCNAME\n\t\tcase \"ns\":\n\t\t\tdnsType = dns.TypeNS\n\t\tcase \"txt\":\n\t\t\tdnsType = dns.TypeTXT\n\t\tcase \"srv\":\n\t\t\tdnsType = dns.TypeSRV\n\t\tcase \"ptr\":\n\t\t\tdnsType = dns.TypePTR\n\t\tcase \"mx\":\n\t\t\tdnsType = dns.TypeMX\n\t\tcase \"soa\":\n\t\t\tdnsType = dns.TypeSOA\n\t\tcase \"caa\":\n\t\t\tdnsType = dns.TypeCAA\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid dns type\")\n\t\t}\n\n\t\toptions := &types.Options{}\n\t\terr := dnsclientpool.Init(options)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdnsClient, err := dnsclientpool.Get(options, &dnsclientpool.Configuration{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// query\n\t\trawResp, err := dnsClient.Query(types.ToString(args[0]), dnsType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/operators/common/dsl/dsl.go#L43-L79","documentation":"Thrown by the 'resolve' DSL helper function in nuclei when its optional second argument (the DNS record type) does not match a supported keyword. The switch accepts 4/a, 6/aaaa, cname, ns, txt, srv, ptr, mx, soa, and caa (case-insensitive after ToLower); any other string aborts before a DNS client is even created. The first argument is the host to resolve; the second selects the record type.","triggerScenarios":"Using resolve('example.com', 'txt ') with trailing whitespace, 'TXT ' uppercase variants that survive trimming issues, or unsupported types like 'axfr', 'any', or 'naptr' in a template expression; passing the arguments in the wrong order (format first, host second) so a hostname lands in the format slot.","commonSituations":"Template authors assuming every miekg/dns type string is supported; typos in matchers/extractors using resolve(); copying examples that use record types added in newer nuclei versions while running an older binary.","solutions":["Use one of the supported keywords: 4, 6, a, aaaa, cname, ns, txt, srv, ptr, mx, soa, caa","Check the argument order: resolve(host, format), e.g. resolve('example.com', 'mx')","Upgrade nuclei if you need additional record types added in later releases"],"exampleFix":"# before (template DSL)\n{{ resolve('example.com', 'axfr') }}\n\n# after\n{{ resolve('example.com', 'a') }}","handlingStrategy":"validation","validationCode":"const dnsTypes = new Set(['4','6','a','aaaa','cname','ns','txt','srv','ptr','mx','soa','caa']);\nconst t = String(recordType).toLowerCase();\nif (dnsTypes.has(t)) { /* safe to use in resolve(host, t) */ }","typeGuard":"function isValidDnsType(t) { return ['4','6','a','aaaa','cname','ns','txt','srv','ptr','mx','soa','caa'].includes(String(t).toLowerCase()); }","tryCatchPattern":null,"preventionTips":["Whitelist the record-type keyword before passing it to resolve()","Remember the order: resolve(host, format)","Trim whitespace from dynamic format strings in template expressions"],"tags":["nuclei","dsl","dns","template","validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}