{"record":{"id":"b1f0177d9f812dab","repo":"hyperledger/fabric","slug":"failed-fetching-config-for-channel-s","errorCode":null,"errorMessage":"failed fetching config for channel %s","messagePattern":"failed fetching config for channel (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"discovery/service.go","lineNumber":158,"sourceCode":"\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))\n\t}\n\treturn &discovery.QueryResult{\n\t\tResult: &discovery.QueryResult_ConfigResult{\n\t\t\tConfigResult: conf,\n\t\t},\n\t}\n}\n\nfunc wrapPeerResponse(peersByOrg map[string]*discovery.Peers) *discovery.QueryResult {\n\treturn &discovery.QueryResult{\n\t\tResult: &discovery.QueryResult_Members{\n\t\t\tMembers: &discovery.PeerMembershipResult{\n\t\t\t\tPeersByOrg: peersByOrg,\n\t\t\t},\n\t\t},\n\t}\n}\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/discovery/service.go#L140-L176","documentation":"This error is returned by configQuery when s.Config(q.Channel) fails to fetch the channel configuration. The discovery service must load a valid, up-to-date channel config to answer config queries; any failure reading or computing that config produces this wrapped error, with the root cause logged server-side.","triggerScenarios":"A discovery client sends a ConfigQuery for a channel whose configuration cannot be retrieved — typically the channel doesn't exist on the peer, the config block can't be read/validated from the ledger, or the underlying config service returns an error.","commonSituations":"Typo in the channel name in the discovery request; client querying a channel no peer in the discovery pool has joined; channel config corruption or genesis-block issues after network bring-up; querying before the channel is fully created.","solutions":["Verify the channel name in the discovery request matches an existing channel ('peer channel list' on a peer)","Check the server log 'Failed fetching config for channel %s' for the root error from s.Config","Confirm the peer handling discovery has joined the channel and its ledger contains the config block","If the channel was recently created, retry after peers have finished processing the genesis/config block"],"exampleFix":"// before\nreq := discovery.NewConfigQuery().AddQuery(\"mychanel\") // misspelled channel\n// after\nreq := discovery.NewConfigQuery().AddQuery(\"mychannel\") // verified via 'peer channel list'","handlingStrategy":"validation","validationCode":"out, err := exec(\"peer channel list\")\nif err != nil || !strings.Contains(string(out), channel) {\n    return fmt.Errorf(\"channel %s not joined by peer; skip config query\", channel)\n}","typeGuard":null,"tryCatchPattern":"resp, err := client.Send(ctx, discovery.NewConfigQuery().AddQuery(channel))\nif err != nil {\n    if strings.Contains(err.Error(), \"failed fetching config\") {\n        return nil, fmt.Errorf(\"config unavailable for %s: %w\", channel, err) // retry later or use local config block\n    }\n    return nil, err\n}","preventionTips":["Validate channel names against 'peer channel list' before config queries","Ensure peers answer discovery only for channels they joined; check join status on deploy","Cache the last-known-good config block as a fallback","Retry with backoff after channel creation completes"],"tags":["hyperledger-fabric","discovery-service","channel-config"],"backgroundTag":"channel-config-fetch-failed","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"}