{"record":{"id":"e1da42fa82673db7","repo":"coredns/coredns","slug":"unhandled-response-type-q-for-q","errorCode":null,"errorMessage":"unhandled response type %q for %q","messagePattern":"unhandled response type %q for %q","errorType":"exception","errorClass":"plugin.Error","httpStatus":null,"severity":"warning","filePath":"plugin/minimal/minimal.go","lineNumber":43,"sourceCode":"\trcode, err := plugin.NextOrFailure(m.Name(), m.Next, ctx, nw, r)\n\tif err != nil {\n\t\treturn rcode, err\n\t}\n\tif nw.Msg == nil {\n\t\treturn rcode, nil\n\t}\n\n\tty, _ := response.Typify(nw.Msg, time.Now().UTC())\n\tcl := response.Classify(ty)\n\n\t// if response is Denial or Error pass through also if the type is Delegation pass through\n\tif cl == response.Denial || cl == response.Error || ty == response.Delegation {\n\t\tw.WriteMsg(nw.Msg)\n\t\treturn 0, nil\n\t}\n\tif ty != response.NoError {\n\t\tw.WriteMsg(nw.Msg)\n\t\treturn 0, plugin.Error(\"minimal\", fmt.Errorf(\"unhandled response type %q for %q\", ty, nw.Msg.Question[0].Name))\n\t}\n\n\t// copy over the original Msg params, deep copy not required as RRs are not modified\n\td := &dns.Msg{\n\t\tMsgHdr:   nw.Msg.MsgHdr,\n\t\tCompress: nw.Msg.Compress,\n\t\tQuestion: nw.Msg.Question,\n\t\tAnswer:   nw.Msg.Answer,\n\t\tNs:       nil,\n\t\tExtra:    nil,\n\t}\n\n\tw.WriteMsg(d)\n\treturn 0, nil\n}\n","sourceCodeStart":25,"sourceCodeEnd":59,"githubUrl":"https://github.com/coredns/coredns/blob/558c9757a92b361e550bdba82d0b4ddf3d12d595/plugin/minimal/minimal.go#L25-L59","documentation":"CoreDNS's minimal plugin returns this error from ServeDNS when a response's classification is not NoError yet was not a Denial, Error, or Delegation either. The plugin only minimizes successful (NOERROR, non-delegation) answers; anything else reaching this branch is a state it does not know how to handle, so it writes the original message and returns a plugin error.","triggerScenarios":"ServeDNS receives a response whose response.Typify classification (ty) is not response.NoError while also not being Denial, Error, or Delegation — e.g. an unusual RCODE/classification combination produced upstream that falls outside the enumerated cases.","commonSituations":"Upstream resolvers or forward targets returning unexpected RCODEs or malformed replies; new response classifications added upstream without updating minimal's switch; running minimal in front of non-DNS-conformant backends.","solutions":["Inspect the upstream response's RCODE/classification with packet capture or logging to see why it is neither NoError, Denial, Error, nor Delegation","Check the CoreDNS version for response.Typify changes; upgrade to a release where the classification is handled","Remove or restrict the minimal plugin from server blocks whose upstreams produce non-NOERROR responses","File/patch the plugin to handle the missing response type"],"exampleFix":"// before\nif ty != response.NoError {\n    return 0, plugin.Error(\"minimal\", fmt.Errorf(\"unhandled response type %q for %q\", ty, nw.Msg.Question[0].Name))\n}\n// after\nif cl != response.NoError {\n    w.WriteMsg(nw.Msg)\n    return 0, nil // or handle the specific type explicitly\n}","handlingStrategy":"fallback","validationCode":"ty := response.Typify(nw.Msg)\ncl := response.Classify(nw.Msg)\nif cl != response.NoError { /* log and pass through the original message */ }","typeGuard":null,"tryCatchPattern":"if code, err := plugin.ServeDNS(...); err != nil { log.Warningf(\"minimal: %v\", err); /* original msg already written */ }","preventionTips":["Only enable minimal for zones whose upstreams reliably return NOERROR answers","Keep response.Typify classification coverage in mind when upgrading CoreDNS","Test upstream RCODE behavior before adding minimal to a server block"],"tags":["coredns","dns","plugin","unhandled-response-type"],"backgroundTag":"unexpected-response-shape","analyzedSha":"558c9757a92b361e550bdba82d0b4ddf3d12d595","analyzedAt":"2026-09-06T22:47:02.106Z","contentChangedAt":"2026-09-06T22:47:02.106Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}