{"record":{"id":"2575e9f0d4be7d8f","repo":"hyperledger/fabric","slug":"unknown-chaincode-s-for-channel-s","errorCode":null,"errorMessage":"unknown chaincode '%s' for channel '%s'","messagePattern":"unknown chaincode '(.+?)' for channel '(.+?)'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/cache.go","lineNumber":358,"sourceCode":"\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\n\t}\n\n\treturn &LocalChaincodeInfo{","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/cache.go#L340-L376","documentation":"ChaincodeInfo throws this when the channel exists in the cache but the requested chaincode name has no entry in that channel's cached Chaincodes map. The cache only contains chaincodes with committed definitions in the new lifecycle; anything not defined (or not yet approved/committed) is 'unknown'.","triggerScenarios":"Calling ChaincodeInfo(channelID, name) where name was never defined via _lifecycle approveformyorg/commit, or the cache has not yet processed the committed definition update.","commonSituations":"Querying a chaincode before 'commit' completed; misspelled chaincode name; cache stale because the listener update for the new definition hasn't landed; checking on a peer that hasn't synced the defining block.","solutions":["Commit the chaincode definition on the channel ('peer lifecycle chaincode commit') before querying.","Verify the exact chaincode name; names are case-sensitive.","Wait for / trigger cache update on the block containing the definition commit, or restart peer if cache handling is suspected broken.","Handle this as a not-found condition in caller logic."],"exampleFix":"// before\ninfo, err := cache.ChaincodeInfo(\"mychannel\", \"mycc\")\n// after\ninfo, err := cache.ChaincodeInfo(\"mychannel\", \"mycc\")\nif err != nil && strings.Contains(err.Error(), \"unknown chaincode\") {\n    return nil, fmt.Errorf(\"chaincode mycc not defined yet: approve and commit first\")\n}","handlingStrategy":"try-catch","validationCode":"approved, err := lc.CheckChaincodeDefinitionApproved(channelID, name, orgMSPID) // ensure defined before info lookup\nif err != nil || !approved { return nil, fmt.Errorf(\"%s not defined on %s\", name, channelID) }","typeGuard":null,"tryCatchPattern":"info, err := cache.ChaincodeInfo(channelID, name)\nvar notFound bool\nif err != nil && strings.Contains(err.Error(), \"unknown chaincode\") { notFound = true }\nif notFound { return nil, ErrChaincodeNotDefined }","preventionTips":["Complete approveformyorg + commit before querying chaincode info.","Validate chaincode names against committed definitions ('querycommitted').","Wait for the commit block event before issuing info queries."],"tags":["fabric","chaincode-not-found","lifecycle"],"backgroundTag":"chaincode-not-defined","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"}