{"record":{"id":"0862bbdd9787f1df","repo":"hyperledger/fabric","slug":"unknown-or-missing-request-type","errorCode":null,"errorMessage":"unknown or missing request type","messagePattern":"unknown or missing request type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/service.go","lineNumber":126,"sourceCode":"\t\tData:      request.Payload,\n\t\tSignature: request.Signature,\n\t\tIdentity:  identity,\n\t}); err != nil {\n\t\tlogger.Warning(\"got query for channel\", query.Channel, \"from\", addr, \"but it isn't eligible:\", err)\n\t\treturn accessDenied\n\t}\n\treturn s.dispatch(query)\n}\n\nfunc (s *Service) dispatch(q *discovery.Query) *discovery.QueryResult {\n\tdispatchers := s.channelDispatchers\n\t// Ensure local queries are routed only to channel-less dispatchers\n\tif q.Channel == \"\" {\n\t\tdispatchers = s.localDispatchers\n\t}\n\tdispatchQuery, exists := dispatchers[protoext.GetQueryType(q)]\n\tif !exists {\n\t\treturn wrapError(errors.New(\"unknown or missing request type\"))\n\t}\n\treturn dispatchQuery(q)\n}\n\nfunc (s *Service) chaincodeQuery(q *discovery.Query) *discovery.QueryResult {\n\tif err := validateCCQuery(q.GetCcQuery()); err != nil {\n\t\treturn wrapError(err)\n\t}\n\tvar descriptors []*discovery.EndorsementDescriptor\n\tfor _, interest := range q.GetCcQuery().Interests {\n\t\tdesc, err := s.PeersForEndorsement(common2.ChannelID(q.Channel), interest)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Failed constructing descriptor for chaincode %s: %v\", interest, err)\n\t\t\treturn wrapError(errors.Errorf(\"failed constructing descriptor for %v\", interest))\n\t\t}\n\t\tdescriptors = append(descriptors, desc)\n\t}\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/service.go#L108-L144","documentation":"Returned by the discovery Service.dispatch when the query's request type has no registered dispatcher: either the query type field is unset/unknown (not one of the defined discovery.Query content types) or the query was routed to the wrong dispatcher table (local vs channel dispatchers only serve certain query types). The service cannot determine what the client is asking for.","triggerScenarios":"A discovery.Query protobuf with no Query_Content set (empty query), a QueryType unknown to protoext.GetQueryType, or a channel-scoped request that only exists as a local dispatcher (or vice versa) so the map lookup dispatchers[GetQueryType(q)] misses.","commonSituations":"Client SDK bug constructing an empty discovery.Query; version mismatch where newer query types are sent to an older peer; manually crafted gRPC requests to the discovery service; wrong endpoint used for local-only queries.","solutions":["Check that the client SDK fully populates the discovery.Query content (e.g. SetCcQuery/SetPeerMembershipQuery) before sending","Align client SDK and Fabric peer versions so query types are mutually supported","Send local-only queries (e.g. local peers) to the local discovery port/endpoint configuration and channel queries with a channel set","Inspect the serialized request if hand-building gRPC calls and confirm the oneof Query_Content is set"],"exampleFix":"// before\nq := &discovery.Query{} // empty content\n// after\nq := &discovery.Query{Content: &discovery.Query_CcQuery{CcQuery: &discovery.ChaincodeQuery{Interests: interests}}}","handlingStrategy":"type-guard","validationCode":"if q.GetContent() == nil { return errors.New(\"discovery.Query has no content set\") }","typeGuard":"func hasQueryContent(q *discovery.Query) bool {\n  return q != nil && q.GetContent() != nil\n}","tryCatchPattern":"result, err := client.Send(ctx, query)\nif err != nil && strings.Contains(err.Error(), \"unknown or missing request type\") {\n  // rebuild the Query with a populated oneof content and matching SDK/peer versions\n}","preventionTips":["Always construct queries via SDK helpers that set the Query oneof","Keep SDK and peer versions aligned for new query types","Use the correct local vs channel discovery endpoints for each query type"],"tags":["fabric","discovery","request-type","grpc","dispatch"],"backgroundTag":"unknown-request-type","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"}