{"record":{"id":"6d057bc1e09ee3eb","repo":"hyperledger/fabric","slug":"channel-s-doesn-t-exist","errorCode":null,"errorMessage":"channel %s doesn't exist","messagePattern":"channel (.+?) doesn't exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/endorser/support.go","lineNumber":49,"sourceCode":"\tGetApplicationConfig(cid string) (channelconfig.Application, bool)\n\tGetLedger(cid string) ledger.PeerLedger\n}\n\n// SupportImpl provides an implementation of the endorser.Support interface\n// issuing calls to various static methods of the peer\ntype SupportImpl struct {\n\t*PluginEndorser\n\tidentity.SignerSerializer\n\tPeer             PeerOperations\n\tChaincodeSupport *chaincode.ChaincodeSupport\n\tACLProvider      aclmgmt.ACLProvider\n\tBuiltinSCCs      scc.BuiltinSCCs\n}\n\nfunc (s *SupportImpl) NewQueryCreator(channel string) (QueryCreator, error) {\n\tlgr := s.Peer.GetLedger(channel)\n\tif lgr == nil {\n\t\treturn nil, errors.Errorf(\"channel %s doesn't exist\", channel)\n\t}\n\treturn lgr, nil\n}\n\nfunc (s *SupportImpl) SigningIdentityForRequest(*pb.SignedProposal) (endorsement.SigningIdentity, error) {\n\treturn s.SignerSerializer, nil\n}\n\n// GetTxSimulator returns the transaction simulator for the specified ledger\n// a client may obtain more than one such simulator; they are made unique\n// by way of the supplied txid\nfunc (s *SupportImpl) GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error) {\n\tlgr := s.Peer.GetLedger(ledgername)\n\tif lgr == nil {\n\t\treturn nil, errors.Errorf(\"Channel does not exist: %s\", ledgername)\n\t}\n\treturn lgr.NewTxSimulator(txid)\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/endorser/support.go#L31-L67","documentation":"SupportImpl.NewQueryCreator could not obtain a ledger for the channel string passed in, meaning the peer has no such channel open. The peer's Peer.GetLedger returns nil for unknown or not-yet-opened channels, so the query creator (used as an endorsement plugin dependency) cannot be built.","triggerScenarios":"initPlugin -> pe.NewQueryCreator(channel) -> SupportImpl.NewQueryCreator with a channel ID for which s.Peer.GetLedger(channel) returns nil — peer not joined to that channel, channel still opening, or channel name mistyped.","commonSituations":"Sending endorsement requests to a peer that never joined the channel; SDK connection profile listing the wrong channel ID; requests during peer startup before channel ledgers open; channel deleted or peer config changed.","solutions":["Join the peer to the channel: peer channel fetch + peer channel join","Confirm with 'peer channel list' that the peer is joined to the intended channel and fix the channel ID in the client config","Wait for peer startup to complete and ledgers to open before submitting proposals","Check peer logs for channel/ledger open failures"],"exampleFix":"// before: targeting peer not on channel\nconst proposal = channel.newProposal(fn, args);\n// after: ensure peer membership\nconst peers = channel.getChannelPeers();\nif (peers.length === 0) throw new Error('peer not joined to channel ' + channel.getName());","handlingStrategy":"validation","validationCode":"const discovered = await discoveryService.getChannelPeers(channelName);\nconst targets = peersOnChannel(discovered); // only endorse on peers that report the channel","typeGuard":"function peerHasChannel(peer, channelId) { return peer.channels?.includes(channelId) ?? false; }","tryCatchPattern":"try {\n  return await endorseOnChannel(channelName);\n} catch (e) {\n  if (e.message.includes(\"doesn't exist\")) {\n    throw new Error(`peer is not joined to ${channelName}; join peer or fix channel ID`, { cause: e });\n  }\n  throw e;\n}","preventionTips":["Verify 'peer channel list' includes the target channel before routing requests","Use service discovery instead of hardcoding peers in connection profiles","Wait for peer readiness before sending proposals after startup","Keep a single source of truth for channel names in application config"],"tags":["hyperledger-fabric","endorser","channel","ledger"],"backgroundTag":"channel-not-joined","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"}