owasp-amass/amass · error
unexpected Meta type: %T
Error message
unexpected Meta type: %T
What it means
This hunter.io plugin handler expects the event's Meta field to be a *et.EmailMeta pointer. If the type assertion fails and Meta is non-nil, the actual email-verification result cannot be applied to the event, so it returns this error naming the concrete unexpected Go type via %T. It is a defensive invariant check against events of the wrong type reaching this handler.
Source
Thrown at engine/plugins/api/hunterio.go:158
var result responseJSON
resp, err := http.RequestWebPage(context.TODO(), &http.Request{URL: h.emailVerifierurl + email.Address + "&api_key=" + api})
if err != nil {
e.Session.Log().Error(fmt.Sprintf("Failed to make Verify request: %v", err),
slog.Group("plugin", "name", h.name, "handler", h.name+"-Email-Verification-Handler"))
return nil
}
if err := json.NewDecoder(strings.NewReader(resp.Body)).Decode(&result); err != nil {
e.Session.Log().Error(fmt.Sprintf("Failed to decode JSON: %v", err),
slog.Group("plugin", "name", h.name, "handler", h.name+"-Email-Verification-Handler"))
return nil
}
eventMeta, ok := e.Meta.(*et.EmailMeta)
if !ok {
if e.Meta != nil {
return fmt.Errorf("unexpected Meta type: %T", e.Meta)
}
return nil
}
eventMeta.VerifyAttempted = true
if result.Data.Status != "unknown" && result.Data.Status != "invalid" &&
result.Data.Status != "disposable" && result.Data.Status != "accept_all" {
eventMeta.Verified = true
}
return nil
}
func (h *hunterIO) account_type(e *et.Event) (string, error) {
api, err := support.GetAPI(h.name, e)
if err != nil || api == "" {
return "", err
}
View on GitHub (pinned to 79299dce87)
Solutions
- Check which event type is routed to this handler and ensure only events carrying *et.EmailMeta reach it.
- Fix the event subscription/filter so the handler only receives email-related events.
- Update the handler to accept and branch on the new Meta type if the pipeline intentionally delivers it.
- Audit the emitting plugin to confirm it sets Meta to *et.EmailMeta for these events.
Example fix
// before
eventMeta, ok := e.Meta.(*et.EmailMeta)
if !ok {
if e.Meta != nil {
return fmt.Errorf("unexpected Meta type: %T", e.Meta)
}
return nil
}
// after
eventMeta, ok := e.Meta.(*et.EmailMeta)
if !ok {
if e.Meta != nil {
return fmt.Errorf("hunterio: unexpected Meta type %T; expected *et.EmailMeta", e.Meta)
}
return nil
} Defensive patterns
Strategy: type-guard
Validate before calling
if e.Meta == nil {
return nil // nothing to verify
} Type guard
eventMeta, ok := e.Meta.(*et.EmailMeta)
if !ok {
// not an email-meta event: skip or log %T
} Try / catch
if err := handler(e); err != nil {
if strings.Contains(err.Error(), "unexpected Meta type") {
// mis-routed event: fix subscription, log and continue
}
} Prevention
- Subscribe handlers only to event types they support
- Always nil-check Meta before type assertion
- Include %T in assertion errors for fast diagnosis
- Add tests covering wrong-typed Meta events
When it happens
Trigger: An event is delivered to this handler with Meta set to a concrete type other than *et.EmailMeta (e.g., *et.DNSResponse, *et.FQDN, or another service record), typically from a misconfigured event stream/subscription or a plugin emitting wrongly-typed metadata.
Common situations: Pipeline wiring changes where the hunterio handler is subscribed to event types it does not support; a plugin refactor changes the Meta payload type; shared callback registered for multiple event types without discriminating on Meta.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- failed to cast the DomainRecord
- failed to cast the IPNetRecord
- failed to cast the TLSCertificate asset
- failed to extract the IPAddress asset
- failed to extract the Service asset
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/dfe0fa2b84341816.
Report an issue: GitHub.