{"record":{"id":"abce0b4985638aab","repo":"hyperledger/fabric","slug":"expected-queryresult-of-either-configresult-or-err","errorCode":null,"errorMessage":"expected QueryResult of either ConfigResult or Error but got %v instead","messagePattern":"expected QueryResult of either ConfigResult or Error but got (.+?) instead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/client/client.go","lineNumber":368,"sourceCode":"\t\t\terr = resp.mapEndorsers(channel2index, r, req.invocationChainMapping)\n\t\tcase protoext.PeerMembershipQueryType:\n\t\t\terr = resp.mapPeerMembership(channel2index, r, protoext.PeerMembershipQueryType)\n\t\tcase protoext.LocalMembershipQueryType:\n\t\t\terr = resp.mapPeerMembership(channel2index, r, protoext.LocalMembershipQueryType)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn resp, err\n}\n\nfunc (resp response) mapConfig(channel2index map[string]int, r *discovery.Response) error {\n\tfor ch, index := range channel2index {\n\t\tconfig, err := protoext.ResponseConfigAt(r, index)\n\t\tif config == nil && err == nil {\n\t\t\treturn errors.Errorf(\"expected QueryResult of either ConfigResult or Error but got %v instead\", r.Results[index])\n\t\t}\n\t\tkey := key{\n\t\t\tqueryType: protoext.ConfigQueryType,\n\t\t\tk:         ch,\n\t\t}\n\n\t\tif err != nil {\n\t\t\tresp[key] = errors.New(err.Content)\n\t\t\tcontinue\n\t\t}\n\n\t\tresp[key] = config\n\t}\n\treturn nil\n}\n\nfunc (resp response) mapPeerMembership(key2Index map[string]int, r *discovery.Response, qt protoext.QueryType) error {\n\tfor k, index := range key2Index {","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/client/client.go#L350-L386","documentation":"mapConfig indexed a discovery response result that is neither a ConfigResult nor an Error payload — the peer returned an unexpected QueryResult oneof variant for a config query, indicating a version/protocol mismatch with the discovery service.","triggerScenarios":"Thrown at discovery/client/client.go:368 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a discovery client version matching the peer's discovery service","Inspect r.Results[index] to identify the unexpected variant"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}