{"record":{"id":"a3935b821ac97ba4","repo":"owasp-amass/amass","slug":"failed-to-extract-the-service-asset","errorCode":null,"errorMessage":"failed to extract the Service asset","messagePattern":"failed to extract the Service asset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/plugins/jarm.go","lineNumber":69,"sourceCode":"\t\tTransforms:   []string{string(oam.Service)},\n\t\tEventType:    oam.Service,\n\t\tCallback:     j.check,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tj.log.Info(\"Plugin started\")\n\treturn nil\n}\n\nfunc (j *jarmPlugin) Stop() {\n\tj.log.Info(\"Plugin stopped\")\n}\n\nfunc (j *jarmPlugin) check(e *et.Event) error {\n\t_, ok := e.Entity.Asset.(*oamplat.Service)\n\tif !ok {\n\t\treturn errors.New(\"failed to extract the Service asset\")\n\t}\n\n\tsince, err := support.TTLStartTime(e.Session.Config(), string(oam.Service), string(oam.Service), j.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !j.hasCertificate(e, since) {\n\t\treturn nil\n\t}\n\n\tsrc := j.source\n\tif !support.AssetMonitoredWithinTTL(e.Session, e.Entity, src, since) {\n\t\tj.query(e, since)\n\t\tsupport.MarkAssetMonitored(e.Session, e.Entity, src)\n\t}\n\treturn nil\n}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/plugins/jarm.go#L51-L87","documentation":"The JARM plugin's check() asserts e.Entity.Asset to *oamplat.Service because JARM fingerprinting operates on service endpoints. If the event carries a different asset type, this error is returned and the event fails. It signals the subscription routed a non-Service entity into the JARM handler.","triggerScenarios":"Events matching the plugin's topic but holding e.g. *oamnet.IPAddress or *oamdns.FQDN assets reach jarmPlugin.check.","commonSituations":"Event topic filters that match more than Service assets; new plugin versions emitting services under a different type; custom service wrappers not implementing the expected struct.","solutions":["Return nil (ignore) instead of an error when the cast fails, so non-Service events are skipped","Narrow the event subscription to Service-typed entities only","Verify all emitters of service events use *oamplat.Service"],"exampleFix":"// before\n_, ok := e.Entity.Asset.(*oamplat.Service)\nif !ok {\n\treturn errors.New(\"failed to extract the Service asset\")\n}\n\n// after\n_, ok := e.Entity.Asset.(*oamplat.Service)\nif !ok {\n\treturn nil\n}","handlingStrategy":"type-guard","validationCode":"if _, ok := e.Entity.Asset.(*oamplat.Service); !ok {\n\treturn nil\n}","typeGuard":"func asService(e *et.Event) (*oamplat.Service, bool) {\n\ts, ok := e.Entity.Asset.(*oamplat.Service)\n\treturn s, ok\n}","tryCatchPattern":"if err := j.check(ev); err != nil {\n\tif strings.Contains(err.Error(), \"failed to extract the Service\") {\n\t\tcontinue // non-Service event\n\t}\n\tlog.Error(err)\n}","preventionTips":["Return nil instead of an error when the asset type is wrong for the handler","Bind the JARM plugin to Service-typed event topics","Keep asset type imports in sync with the library version you build against"],"tags":["go","type-assertion","service"],"backgroundTag":"type-mismatch","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"}