hyperledger/fabric · error
failed constructing descriptor for %v
Error message
failed constructing descriptor for %v
What it means
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.
Source
Thrown at discovery/service.go:140
dispatchers = s.localDispatchers
}
dispatchQuery, exists := dispatchers[protoext.GetQueryType(q)]
if !exists {
return wrapError(errors.New("unknown or missing request type"))
}
return dispatchQuery(q)
}
func (s *Service) chaincodeQuery(q *discovery.Query) *discovery.QueryResult {
if err := validateCCQuery(q.GetCcQuery()); err != nil {
return wrapError(err)
}
var descriptors []*discovery.EndorsementDescriptor
for _, interest := range q.GetCcQuery().Interests {
desc, err := s.PeersForEndorsement(common2.ChannelID(q.Channel), interest)
if err != nil {
logger.Errorf("Failed constructing descriptor for chaincode %s: %v", interest, err)
return wrapError(errors.Errorf("failed constructing descriptor for %v", interest))
}
descriptors = append(descriptors, desc)
}
return &discovery.QueryResult{
Result: &discovery.QueryResult_CcQueryRes{
CcQueryRes: &discovery.ChaincodeQueryResult{
Content: descriptors,
},
},
}
}
func (s *Service) configQuery(q *discovery.Query) *discovery.QueryResult {
conf, err := s.Config(q.Channel)
if err != nil {
logger.Errorf("Failed fetching config for channel %s: %v", q.Channel, err)
return wrapError(errors.Errorf("failed fetching config for channel %s", q.Channel))View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before
interests := []*discovery.ChaincodeCall{{Name: "mycc "}} // trailing space / wrong name
result, _ := client.Send(ctx, discovery.NewChaincodeQuery(interests, "mychannel"))
// after
interests := []*discovery.ChaincodeCall{{Name: "mycc"}} // exact installed name
result, err := client.Send(ctx, discovery.NewChaincodeQuery(interests, "mychannel"))
if err != nil { log.Fatalf("discovery chaincode query failed: %v", err) } Defensive patterns
Strategy: validation
Validate before calling
inst := execQuery("peer chaincode list -C mychannel")
if !strings.Contains(inst, "mycc") {
return fmt.Errorf("chaincode mycc not instantiated on mychannel; skip discovery query")
} Try / catch
desc, err := client.Send(ctx, discovery.NewChaincodeQuery(interests, channel))
if err != nil {
if strings.Contains(err.Error(), "failed constructing descriptor") {
// fall back to static peer list configured out-of-band
return staticPeers[channel], nil
}
return nil, err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed assembling endorsers of channel %s
- expected %d endorsement descriptors but got only %d
- expected chaincode %s but got endorsement descriptor for %s
- no chaincode interests given
- chaincode interest is nil
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/495fe2dcff5c35d9.
Report an issue: GitHub.