{"record":{"id":"955fc9149b93d306","repo":"hyperledger/fabric","slug":"could-not-retrieve-committed-definition-for-chainc","errorCode":null,"errorMessage":"could not retrieve committed definition for chaincode '%s'","messagePattern":"could not retrieve committed definition for chaincode '(.+?)'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/scc.go","lineNumber":764,"sourceCode":"\t// towards catching manual errors in the config as oppose to any attempt of serializability.\n\tchannelConfig := i.SCC.ChannelConfigSource.GetStableChannelConfig(i.ChannelID)\n\tif channelConfig == nil {\n\t\treturn errors.Errorf(\"could not get channelconfig for channel '%s'\", i.ChannelID)\n\t}\n\tmspMgr := channelConfig.MSPManager()\n\tif mspMgr == nil {\n\t\treturn errors.Errorf(\"could not get MSP manager for channel '%s'\", i.ChannelID)\n\t}\n\n\tif err := validateCollectionConfigs(collConfigs, mspMgr); err != nil {\n\t\treturn err\n\t}\n\n\t// validate against collection configs in the committed definition\n\tqe := i.SCC.QueryExecutorProvider.TxQueryExecutor(i.Stub.GetChannelID(), i.Stub.GetTxID())\n\tcommittedCCDef, err := i.SCC.DeployedCCInfoProvider.ChaincodeInfo(i.ChannelID, name, qe)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not retrieve committed definition for chaincode '%s'\", name)\n\t}\n\tif committedCCDef == nil {\n\t\treturn nil\n\t}\n\tif err := validateCollConfigsAgainstCommittedDef(collConfigs, committedCCDef.ExplicitCollectionConfigPkg); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc extractStaticCollectionConfigs(collConfigPkg *pb.CollectionConfigPackage) ([]*pb.StaticCollectionConfig, error) {\n\tif collConfigPkg == nil || len(collConfigPkg.Config) == 0 {\n\t\treturn nil, nil\n\t}\n\tcollConfigs := make([]*pb.StaticCollectionConfig, len(collConfigPkg.Config))\n\tfor i, c := range collConfigPkg.Config {\n\t\tswitch t := c.Payload.(type) {\n\t\tcase *pb.CollectionConfig_StaticCollectionConfig:","sourceCodeStart":746,"sourceCodeEnd":782,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/scc.go#L746-L782","documentation":"validateInput reads the committed chaincode definition via DeployedCCInfoProvider.ChaincodeInfo using the transaction's query executor. An underlying error from that lookup is wrapped with this message — the committed state for the chaincode could not be read, often a state database or ledger access failure.","triggerScenarios":"Ledger/query-executor error while reading committed chaincode info during approve or commit (e.g. state DB corruption, IO error), triggered for any chaincode name being validated.","commonSituations":"Corrupt LevelDB/CouchDB state database, ledger file issues after a crash, or transient storage failures on the peer.","solutions":["Inspect peer logs for the wrapped root cause from ChaincodeInfo","Rebuild the state database (recreate state DB so it is rebuilt from the ledger)","Restart the peer and retry the transaction if the failure was transient"],"exampleFix":"// before: peer with corrupt state DB\n// peer.log: could not retrieve committed definition ... couchdb: connection refused\n// after: rebuild state DB\n# stop peer, remove /var/hyperledger/production/ledgersData/stateLeveldb, restart peer","handlingStrategy":"retry","validationCode":"// Go: pre-check chaincode readability via the same provider before lifecycle invoke\n_, err := deployedCCInfoProvider.ChaincodeInfo(channelID, name, qe)\nreturn err // surface storage issues early","typeGuard":null,"tryCatchPattern":"const maxRetries = 3\nfor i := 0; i < maxRetries; i++ {\n    _, err := scc.Invoke(...)\n    if err == nil || !strings.Contains(err.Error(), \"could not retrieve committed definition\") { break }\n    time.Sleep(2*time.Second) // transient storage failure backoff\n}","preventionTips":["Monitor state DB health (LevelDB/CouchDB) and disk space on peers","Rebuild state DBs after unclean shutdown or corruption warnings","Restart peers promptly on ledger IO errors"],"tags":["hyperledger-fabric","ledger","state-database"],"backgroundTag":"ledger-read-failure","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"}