hyperledger/fabric · error
chaincode definition for '%s' at sequence %d on channel '%s'
Error message
chaincode definition for '%s' at sequence %d on channel '%s' has not yet been approved by this org
What it means
CachedChaincodeInfo returns this when the chaincode definition exists at the current committed sequence but chaincodeInfo.Approved is false — i.e., this organization has not approved the chaincode definition for that name/sequence on the channel. Without a local approval, the peer refuses to supply endorsement info for V2.0 lifecycle chaincode.
Source
Thrown at core/chaincode/lifecycle/endorsement_info.go:89
if currentSequence == 0 {
return nil, false, nil
}
chaincodeInfo, err := cei.Cache.ChaincodeInfo(channelID, chaincodeName)
if err != nil {
return nil, false, errors.WithMessage(err, "could not get approved chaincode info from cache")
}
if chaincodeInfo.Definition.Sequence != currentSequence {
// TODO this is a transient error which indicates that this query executor is executing against a chaincode
// whose definition has already changed (the cache may be ahead of the committed state, but never behind). In this
// case, we should simply abort the tx, and re-acquire a query executor and re-execute. There is no reason this
// error needs to be returned to the client.
return nil, false, errors.Errorf("chaincode cache at sequence %d but current sequence is %d, chaincode definition for '%s' changed during invoke", chaincodeInfo.Definition.Sequence, currentSequence, chaincodeName)
}
if !chaincodeInfo.Approved {
return nil, false, errors.Errorf("chaincode definition for '%s' at sequence %d on channel '%s' has not yet been approved by this org", chaincodeName, currentSequence, channelID)
}
if chaincodeInfo.InstallInfo == nil {
if cei.UserRunsCC {
chaincodeInfo.InstallInfo = &ChaincodeInstallInfo{
PackageID: chaincodeName + ":" + chaincodeInfo.Definition.EndorsementInfo.Version,
}
return chaincodeInfo, true, nil
}
return nil, false, errors.Errorf("chaincode definition for '%s' exists, but chaincode is not installed", chaincodeName)
}
return chaincodeInfo, true, nil
}
// ChaincodeEndorsementInfo returns the information necessary to handle a chaincode invocation request, as well as a function to
// enforce security checks on the chaincode (in case the definition is from the legacy lscc).
func (cei *ChaincodeEndorsementInfoSource) ChaincodeEndorsementInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (*ChaincodeEndorsementInfo, error) {View on GitHub (pinned to 2736b63f8f)
Solutions
- Run `peer lifecycle chaincode approveformyorg` on the org with the same definition (name, version, sequence, packageID) that was committed.
- Check with `peer lifecycle chaincode checkcommitreadiness` which orgs are still missing approvals.
- Verify the installed packageID matches the one referenced in the approval (peer lifecycle chaincode queryinstalled).
- If the sequence advanced, re-approve for the new sequence.
Example fix
// before: only one org approved, then commit peer lifecycle chaincode commit -o orderer:7050 --channelID ch1 --name cc -v 1.0 --sequence 1 // after: every org approves first peer lifecycle chaincode approveformyorg -o orderer:7050 --channelID ch1 --name cc --version 1.0 --package-id cc_abc:abc --sequence 1 peer lifecycle chaincode commit ...
Defensive patterns
Strategy: validation
Validate before calling
// shell: check readiness across orgs before commit/endorse peer lifecycle chaincode checkcommitreadiness \ --channelID ch1 --name mycc --version 1.0 --sequence 1 --output json # expect every org's approved flag to be true
Try / catch
err := endorse(...)
if err != nil && strings.Contains(err.Error(), "has not yet been approved by this org") {
// run approveformyorg for this org then retry
} Prevention
- Run approveformyorg on every org before commit.
- Verify approvals with checkcommitreadiness.
- Re-approve whenever sequence or packageID changes.
- For new peers, ensure the org's approval exists (approval is org-level, stored on each peer's ledger).
When it happens
Trigger: ChaincodeEndorsementInfo -> CachedChaincodeInfo finds a committed definition at currentSequence whose Approved flag is false because approveformyorg was never run (or was run for a different sequence/packageID) on this peer's org.
Common situations: One org committed a definition while another org skipped approval; approval done before sequence changed so it no longer matches; packageID in approval doesn't match the installed package; new peer joined org without running lifecycle approve.
Related errors
- chaincode definition not agreed to by this org (%s)
- could not get channel config for channel '%s'
- could not get application config for channel '%s'
- no such collection '%s'
- chaincode cache at sequence %d but current sequence is %d, c
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/7777570866d41c76.
Report an issue: GitHub.