{"record":{"id":"0ddb4c431ad508fe","repo":"projectdiscovery/nuclei","slug":"no-records-found","errorCode":null,"errorMessage":"no records found","messagePattern":"no records found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/operators/common/dsl/dsl.go","lineNumber":100,"sourceCode":"\t\t\tdns.TypeAAAA:  rawResp.AAAA,\n\t\t\tdns.TypeCNAME: rawResp.CNAME,\n\t\t\tdns.TypeNS:    rawResp.NS,\n\t\t\tdns.TypeTXT:   rawResp.TXT,\n\t\t\tdns.TypeSRV:   rawResp.SRV,\n\t\t\tdns.TypePTR:   rawResp.PTR,\n\t\t\tdns.TypeMX:    rawResp.MX,\n\t\t\tdns.TypeCAA:   rawResp.CAA,\n\t\t\tdns.TypeSOA:   rawResp.GetSOARecords(),\n\t\t}\n\n\t\tif values, ok := dnsValues[dnsType]; ok {\n\t\t\tfirstFound, found := sliceutil.FirstNonZero(values)\n\t\t\tif found {\n\t\t\t\treturn firstFound, nil\n\t\t\t}\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"no records found\")\n\t}))\n\t_ = dsl.AddFunction(dsl.NewWithMultipleSignatures(\"getNetworkPort\", []string{\n\t\t\"(Port string,defaultPort string) string)\",\n\t\t\"(Port int,defaultPort int) int\",\n\t}, false, func(args ...interface{}) (interface{}, error) {\n\t\tif len(args) != 2 {\n\t\t\treturn nil, dsl.ErrInvalidDslFunction\n\t\t}\n\t\tport := types.ToString(args[0])\n\t\tdefaultPort := types.ToString(args[1])\n\t\tif port == \"\" || stringsutil.EqualFoldAny(port, knowPorts...) {\n\t\t\treturn defaultPort, nil\n\t\t}\n\t\treturn port, nil\n\t}))\n\n\tdsl.PrintDebugCallback = func(args ...interface{}) error {\n\t\tgologger.Debug().Msgf(\"print_debug value: %s\", fmt.Sprint(args...))","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/operators/common/dsl/dsl.go#L82-L118","documentation":"Runtime DSL failure raised by the built-in `resolve()` helper (pkg/operators/common/dsl/dsl.go:100). `resolve(host[, format])` performs a live DNS query through nuclei' dnsclientpool for a record type (a, aaaa, cname, ns, txt, srv, ptr, mx, soa, caa); if the query succeeds but sliceutil.FirstNonZero finds no non-empty value in the matching record slice, it returns this error, which fails the whole DSL matcher/extractor expression.","triggerScenarios":"A DSL matcher/extractor such as `dsl: resolve('{{Hostname}}','mx') != ''` executed against a domain that has no MX records (or none of the requested type). The DNS exchange itself succeeds (a query error returns a different error), but rawResp.MX/TXT/CAA/etc. is empty or all-zero.","commonSituations":"Templates assuming a record type that the target zone does not publish (e.g. CAA or SRV on typical domains); internal/intranet hosts with split-horizon DNS that return empty answers; newly created domains with only A records; templating `resolve()` against arbitrary user-supplied targets where record absence is normal.","solutions":["Verify with `dig <host> <TYPE> +short` that the record exists for the target before using `resolve()` with that type in the template","If record absence is expected, do not gate the matcher on `resolve()`: use the dedicated `dns` protocol block with its own question/matcher, which handles empty answers gracefully","Restrict the template's matcher to targets known to have the record (e.g. via a preliminary condition), or default the format to '4'/'a' which nearly always resolves","For SDK/Go usage, treat the returned error as 'no match' rather than a scan failure — the error is per-expression and non-fatal to the scan"],"exampleFix":"# before\ndsl:\n  - resolve('{{BaseDomain}}','mx') != ''\n# after (use the dns protocol, which matches on the actual DNS answer)\ndns:\n  - type: MX\n    host: '{{BaseDomain}}'\n    matchers:\n      - type: word\n        words:\n          - '{{mx_record}}'","handlingStrategy":"try-catch","validationCode":"# pre-check the record exists before relying on resolve() in a template\n# (shell equivalent of the guard)\ndig +short \"$HOST\" MX | grep -q . && echo 'safe to use resolve(mx)' || echo 'skip'","typeGuard":"func hasDNSRecord(host, rtype string) bool {\n\t// reuse miekg/dns or net.LookupMX style API; treat error as false\n\t_, err := net.LookupMX(host)\n\treturn err == nil\n}","tryCatchPattern":"// in Go SDK: evaluate DSL manually and degrade to no-match\nresult, err := govaluate.NewEvaluableExpressionWithFunctions(dslExpr, dsl.HelperFunctions)\nif err != nil { /* compile error: template bug */ }\nif _, err := result.Evaluate(data); err != nil {\n\tif strings.Contains(err.Error(), \"no records found\") {\n\t\t// record absence => not a finding, continue scan\n\t}\n}","preventionTips":["Only call resolve('<type>') for record types confirmed present via dig/host during template authoring","Prefer the dns protocol block over DSL resolve when absent records are expected","Default to format '4' (A) which virtually always exists for resolvable hosts","Treat resolve() errors as non-findings in SDK result handling, not scan aborts"],"tags":["dns","dsl","runtime","template","matcher"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}