hyperledger/fabric · error

could not retrieve committed definition for chaincode '%s'

Error message

could not retrieve committed definition for chaincode '%s'

What it means

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.

Source

Thrown at core/chaincode/lifecycle/scc.go:764

	// towards catching manual errors in the config as oppose to any attempt of serializability.
	channelConfig := i.SCC.ChannelConfigSource.GetStableChannelConfig(i.ChannelID)
	if channelConfig == nil {
		return errors.Errorf("could not get channelconfig for channel '%s'", i.ChannelID)
	}
	mspMgr := channelConfig.MSPManager()
	if mspMgr == nil {
		return errors.Errorf("could not get MSP manager for channel '%s'", i.ChannelID)
	}

	if err := validateCollectionConfigs(collConfigs, mspMgr); err != nil {
		return err
	}

	// validate against collection configs in the committed definition
	qe := i.SCC.QueryExecutorProvider.TxQueryExecutor(i.Stub.GetChannelID(), i.Stub.GetTxID())
	committedCCDef, err := i.SCC.DeployedCCInfoProvider.ChaincodeInfo(i.ChannelID, name, qe)
	if err != nil {
		return errors.Wrapf(err, "could not retrieve committed definition for chaincode '%s'", name)
	}
	if committedCCDef == nil {
		return nil
	}
	if err := validateCollConfigsAgainstCommittedDef(collConfigs, committedCCDef.ExplicitCollectionConfigPkg); err != nil {
		return err
	}
	return nil
}

func extractStaticCollectionConfigs(collConfigPkg *pb.CollectionConfigPackage) ([]*pb.StaticCollectionConfig, error) {
	if collConfigPkg == nil || len(collConfigPkg.Config) == 0 {
		return nil, nil
	}
	collConfigs := make([]*pb.StaticCollectionConfig, len(collConfigPkg.Config))
	for i, c := range collConfigPkg.Config {
		switch t := c.Payload.(type) {
		case *pb.CollectionConfig_StaticCollectionConfig:

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Inspect peer logs for the wrapped root cause from ChaincodeInfo
  2. Rebuild the state database (recreate state DB so it is rebuilt from the ledger)
  3. Restart the peer and retry the transaction if the failure was transient

Example fix

// before: peer with corrupt state DB
// peer.log: could not retrieve committed definition ... couchdb: connection refused
// after: rebuild state DB
# stop peer, remove /var/hyperledger/production/ledgersData/stateLeveldb, restart peer
Defensive patterns

Strategy: retry

Validate before calling

// Go: pre-check chaincode readability via the same provider before lifecycle invoke
_, err := deployedCCInfoProvider.ChaincodeInfo(channelID, name, qe)
return err // surface storage issues early

Try / catch

const maxRetries = 3
for i := 0; i < maxRetries; i++ {
    _, err := scc.Invoke(...)
    if err == nil || !strings.Contains(err.Error(), "could not retrieve committed definition") { break }
    time.Sleep(2*time.Second) // transient storage failure backoff
}

Prevention

When it happens

Trigger: 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.

Common situations: Corrupt LevelDB/CouchDB state database, ledger file issues after a crash, or transient storage failures on the peer.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/955fc9149b93d306. Report an issue: GitHub.