projectdiscovery/nuclei · warning
no records found
Error message
no records found
What it means
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.
Source
Thrown at pkg/operators/common/dsl/dsl.go:100
dns.TypeAAAA: rawResp.AAAA,
dns.TypeCNAME: rawResp.CNAME,
dns.TypeNS: rawResp.NS,
dns.TypeTXT: rawResp.TXT,
dns.TypeSRV: rawResp.SRV,
dns.TypePTR: rawResp.PTR,
dns.TypeMX: rawResp.MX,
dns.TypeCAA: rawResp.CAA,
dns.TypeSOA: rawResp.GetSOARecords(),
}
if values, ok := dnsValues[dnsType]; ok {
firstFound, found := sliceutil.FirstNonZero(values)
if found {
return firstFound, nil
}
}
return "", fmt.Errorf("no records found")
}))
_ = dsl.AddFunction(dsl.NewWithMultipleSignatures("getNetworkPort", []string{
"(Port string,defaultPort string) string)",
"(Port int,defaultPort int) int",
}, false, func(args ...interface{}) (interface{}, error) {
if len(args) != 2 {
return nil, dsl.ErrInvalidDslFunction
}
port := types.ToString(args[0])
defaultPort := types.ToString(args[1])
if port == "" || stringsutil.EqualFoldAny(port, knowPorts...) {
return defaultPort, nil
}
return port, nil
}))
dsl.PrintDebugCallback = func(args ...interface{}) error {
gologger.Debug().Msgf("print_debug value: %s", fmt.Sprint(args...))View on GitHub (pinned to 265b3a3dec)
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
Example fix
# before
dsl:
- resolve('{{BaseDomain}}','mx') != ''
# after (use the dns protocol, which matches on the actual DNS answer)
dns:
- type: MX
host: '{{BaseDomain}}'
matchers:
- type: word
words:
- '{{mx_record}}' Defensive patterns
Strategy: try-catch
Validate before calling
# pre-check the record exists before relying on resolve() in a template # (shell equivalent of the guard) dig +short "$HOST" MX | grep -q . && echo 'safe to use resolve(mx)' || echo 'skip'
Type guard
func hasDNSRecord(host, rtype string) bool {
// reuse miekg/dns or net.LookupMX style API; treat error as false
_, err := net.LookupMX(host)
return err == nil
} Try / catch
// in Go SDK: evaluate DSL manually and degrade to no-match
result, err := govaluate.NewEvaluableExpressionWithFunctions(dslExpr, dsl.HelperFunctions)
if err != nil { /* compile error: template bug */ }
if _, err := result.Evaluate(data); err != nil {
if strings.Contains(err.Error(), "no records found") {
// record absence => not a finding, continue scan
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unresolved DSL placeholders must be inside string literals
- unresolved DSL placeholder %q is not inside a string literal
- invalid dns type
- failed to compile expression %q: %w
- failed to evaluate expression %q: %w
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/0ddb4c431ad508fe.
Report an issue: GitHub.