{"record":{"id":"495fe2dcff5c35d9","repo":"hyperledger/fabric","slug":"failed-constructing-descriptor-for-v","errorCode":null,"errorMessage":"failed constructing descriptor for %v","messagePattern":"failed constructing descriptor for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/service.go","lineNumber":140,"sourceCode":"\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\n\treturn &discovery.QueryResult{\n\t\tResult: &discovery.QueryResult_CcQueryRes{\n\t\t\tCcQueryRes: &discovery.ChaincodeQueryResult{\n\t\t\t\tContent: descriptors,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (s *Service) configQuery(q *discovery.Query) *discovery.QueryResult {\n\tconf, err := s.Config(q.Channel)\n\tif err != nil {\n\t\tlogger.Errorf(\"Failed fetching config for channel %s: %v\", q.Channel, err)\n\t\treturn wrapError(errors.Errorf(\"failed fetching config for channel %s\", q.Channel))","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/service.go#L122-L158","documentation":"This error is returned by the discovery service's chaincodeQuery handler when PeersForEndorsement cannot build an endorsement descriptor for a requested chaincode interest. It means the service could not compute a set of peers (grouped by organization) that together satisfy the chaincode's endorsement policy. The underlying cause is logged server-side; the client only receives the wrapped message.","triggerScenarios":"A discovery client sends a ChaincodeQuery (or ChaincodeQuery by chains) interest for a chaincode whose endorsement peers cannot be found — e.g. the chaincode is not instantiated on any peer in the channel, the interest lists collections or chaincode names that don't exist, or no peers of the required organizations have joined the channel.","commonSituations":"Querying discovery for a chaincode that was never installed/instantiated; typos in chaincode name or collection name in the interest; peer has joined the channel but hasn't downloaded the chaincode; channel membership changed so endorsement policy prerequisites can't be met; stale discovery cache after network reconfiguration.","solutions":["Verify the chaincode name (and collection names) in the discovery interest exactly match what is installed and instantiated on peers in that channel","Run 'peer chaincode list --channelID <channel>' (or query instantiated chaincodes) to confirm the chaincode exists","Check the server log line 'Failed constructing descriptor for chaincode %s' for the underlying reason returned by PeersForEndorsement","Ensure at least one peer per required endorsement-policy organization has joined the channel and is reachable by the discovery service","Re-run the discovery query after correcting the interest; consider querying for config/peers first to validate channel membership"],"exampleFix":"// before\ninterests := []*discovery.ChaincodeCall{{Name: \"mycc \"}} // trailing space / wrong name\nresult, _ := client.Send(ctx, discovery.NewChaincodeQuery(interests, \"mychannel\"))\n// after\ninterests := []*discovery.ChaincodeCall{{Name: \"mycc\"}} // exact installed name\nresult, err := client.Send(ctx, discovery.NewChaincodeQuery(interests, \"mychannel\"))\nif err != nil { log.Fatalf(\"discovery chaincode query failed: %v\", err) }","handlingStrategy":"validation","validationCode":"inst := execQuery(\"peer chaincode list -C mychannel\")\nif !strings.Contains(inst, \"mycc\") {\n    return fmt.Errorf(\"chaincode mycc not instantiated on mychannel; skip discovery query\")\n}","typeGuard":null,"tryCatchPattern":"desc, err := client.Send(ctx, discovery.NewChaincodeQuery(interests, channel))\nif err != nil {\n    if strings.Contains(err.Error(), \"failed constructing descriptor\") {\n        // fall back to static peer list configured out-of-band\n        return staticPeers[channel], nil\n    }\n    return nil, err\n}","preventionTips":["Keep chaincode names/collections in config validated against 'peer chaincode list' output","Before querying discovery, run a peer/channel membership check (config or local peer query)","Monitor server-side 'Failed constructing descriptor' logs and alert on them","Pin SDK and Fabric versions to avoid interest-format mismatches"],"tags":["hyperledger-fabric","discovery-service","chaincode","endorsement"],"backgroundTag":"endorsement-descriptor-not-found","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}