{"record":{"id":"2dd4ffd4c25141de","repo":"hyperledger/fabric","slug":"unknown-channel-s","errorCode":null,"errorMessage":"unknown channel '%s'","messagePattern":"unknown channel '(.+?)'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/cache.go","lineNumber":355,"sourceCode":"// ChaincodeInfo returns the chaincode definition and its install info.\n// An error is returned only if either the channel or the chaincode do not exist.\nfunc (c *Cache) ChaincodeInfo(channelID, name string) (*LocalChaincodeInfo, error) {\n\tif name == LifecycleNamespace {\n\t\tac, ok := c.Resources.ChannelConfigSource.GetStableChannelConfig(channelID).ApplicationConfig()\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"application config does not exist for channel '%s'\", channelID)\n\t\t}\n\t\tif !ac.Capabilities().LifecycleV20() {\n\t\t\treturn nil, errors.Errorf(\"cannot use _lifecycle without V2_0 application capabilities enabled for channel '%s'\", channelID)\n\t\t}\n\t\treturn c.getLifecycleSCCChaincodeInfo(channelID)\n\t}\n\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\tchannelChaincodes, ok := c.definedChaincodes[channelID]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"unknown channel '%s'\", channelID)\n\t}\n\n\tcachedChaincode, ok := channelChaincodes.Chaincodes[name]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"unknown chaincode '%s' for channel '%s'\", name, channelID)\n\t}\n\n\treturn &LocalChaincodeInfo{\n\t\tDefinition:  cachedChaincode.Definition,\n\t\tInstallInfo: cachedChaincode.InstallInfo,\n\t\tApproved:    cachedChaincode.Approved,\n\t}, nil\n}\n\nfunc (c *Cache) getLifecycleSCCChaincodeInfo(channelID string) (*LocalChaincodeInfo, error) {\n\tpolicyBytes, err := c.Resources.LifecycleEndorsementPolicyAsBytes(channelID)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/cache.go#L337-L373","documentation":"ChaincodeInfo throws this when the cache has no entry for the requested channelID in definedChaincodes. The cache only learns channels via Initialize/SetChaincodesMapForUninitializedChannels, so a channel that was never initialized (or unknown channel ID) yields 'unknown channel'.","triggerScenarios":"Calling ChaincodeInfo with a channelID never initialized in the cache — e.g. peer has not joined the channel, or the cache was constructed but RegisterListener/InitializeMetadata was never run for that channel.","commonSituations":"Typo'd channel name; peer joined the channel after callers started querying; cache created before channel initialization completed; querying a channel the peer is not a member of.","solutions":["Verify the peer has joined the channel ('peer channel list') and the channelID spelling is exact.","Ensure Cache.Initialize(channelID, queryExecutor) or SetChaincodesMapForUninitializedChannels ran before querying.","Re-check that channel initialization completed (peer channel initialization, INITIALIZE channel ledger).","If the channel is genuinely absent, treat this as an expected 'not found' and handle it, not as a retryable fault."],"exampleFix":"// before\ninfo, err := cache.ChaincodeInfo(channelID, name)\n// after\nif _, joined := joinedChannels[channelID]; !joined {\n    return nil, fmt.Errorf(\"skip: peer not joined to %s\", channelID)\n}\ninfo, err := cache.ChaincodeInfo(channelID, name)","handlingStrategy":"validation","validationCode":"joined, _ := stub.GetChannels() // or peer channel list\nif !containsChannel(joined, channelID) {\n    return fmt.Errorf(\"peer not joined to channel %s\", channelID)\n}","typeGuard":null,"tryCatchPattern":"info, err := cache.ChaincodeInfo(channelID, name)\nif err != nil && strings.Contains(err.Error(), \"unknown channel\") {\n    return nil, fmt.Errorf(\"channel %s not initialized in cache: %w\", channelID, err)\n}","preventionTips":["Confirm channel membership with 'peer channel list' before lifecycle queries.","Ensure cache Initialize/SetChaincodesMapForUninitializedChannels runs at peer startup for joined channels.","Keep channel names in a single source of truth (config/env) to avoid typos."],"tags":["fabric","channel-not-found","cache"],"backgroundTag":"unknown-channel","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"}