{"record":{"id":"4fa40d25a1e4c0e4","repo":"owasp-amass/amass","slug":"no-ptr-data-found-for-s","errorCode":null,"errorMessage":"no PTR data found for %s","messagePattern":"no PTR data found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/plugins/horizontals/ipaddr.go","lineNumber":83,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to acquire the entity with ID: %s\", edges[0].ToEntity.ID)\n\t}\n\n\treturn ptr, nil\n}\n\nfunc (h *horaddr) lookupPTRRecordData(sess et.Session, ptr *dbt.Entity) (*dbt.Entity, error) {\n\tsince, err := support.TTLStartTime(sess.Config(), string(oam.FQDN), string(oam.FQDN), h.plugin.name)\n\tif err != nil || since.IsZero() {\n\t\treturn nil, errors.New(\"FQDN -> FQDN transformation not supported\")\n\t}\n\n\tctx, cancel := context.WithTimeout(sess.Ctx(), 30*time.Second)\n\tdefer cancel()\n\n\tedges, err := sess.DB().OutgoingEdges(ctx, ptr, since, \"dns_record\")\n\tif err != nil || len(edges) == 0 {\n\t\treturn nil, fmt.Errorf(\"no PTR data found for %s\", ptr.Asset.Key())\n\t}\n\n\tfor _, edge := range edges {\n\t\tif rel, ok := edge.Relation.(*oamdns.BasicDNSRelation); !ok || rel.Header.RRType != 12 {\n\t\t\tcontinue\n\t\t}\n\n\t\tto, err := sess.DB().FindEntityById(ctx, edge.ToEntity.ID)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, valid := to.Asset.(*oamdns.FQDN); valid {\n\t\t\treturn to, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"failed to obtain the FQDN from the PTR data\")","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/horizontals/ipaddr.go#L65-L101","documentation":"lookupPTRRecordData follows 'dns_record' edges from the PTR name entity to find the actual DNS answer data. If no such edges exist (or the query errors), the PTR name has no stored DNS data, and this error is returned. The plugin needs this data to extract the hostname pointed to by the reverse record.","triggerScenarios":"sess.DB().OutgoingEdges(ctx, ptr, since, \"dns_record\") returns err != nil or zero edges for the PTR FQDN entity within the 'since' window; or all edges exist but none carries a BasicDNSRelation with RRType 12 (PTR) so the loop finds no match.","commonSituations":"DNS resolution data was never collected for the PTR name by any plugin; data was released so old dns_record edges are filtered; resolution of the PTR name itself failed upstream; only non-PTR RRTypes were stored for the name.","solutions":["Ensure DNS resolution of the PTR name happens (e.g., the dns plugin resolves it) before this horizontal step.","Widen the 'since' timestamp so existing dns_record edges are not filtered out.","Check that stored relations keep the RRType 12 (PTR) relation — a relation-type change would skip all edges.","Handle gracefully in check(): skip the PTR name when no data exists.","Log the underlying OutgoingEdges error separately from the empty case."],"exampleFix":"// before\nedges, err := sess.DB().OutgoingEdges(ctx, ptr, since, \"dns_record\")\nif err != nil || len(edges) == 0 {\n\treturn nil, fmt.Errorf(\"no PTR data found for %s\", ptr.Asset.Key())\n}\n// after\nedges, err := sess.DB().OutgoingEdges(ctx, ptr, since, \"dns_record\")\nif err != nil {\n\treturn nil, fmt.Errorf(\"no PTR data found for %s: %w\", ptr.Asset.Key(), err)\n}\nif len(edges) == 0 {\n\treturn nil, fmt.Errorf(\"no PTR data found for %s\", ptr.Asset.Key())\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"data, err := lookupPTRRecordData(sess, ptrEnt)\nif err != nil {\n\t// PTR name not resolved: skip this horizontal path\n\treturn nil\n}","preventionTips":["Ensure DNS resolution runs before horizontals depend on dns_record edges","Keep RRType 12 (PTR) relations intact when changing relation types","Use a generous 'since' window for historical edges","Skip gracefully when a PTR name is unresolvable"],"tags":["go","database","dns","ptr"],"backgroundTag":"record-not-found","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}