hyperledger/fabric · warning
chaincode already successfully installed (package ID '%s')
Error message
chaincode already successfully installed (package ID '%s')
What it means
During install, lifecycle registers the package ID in the BuildRegistry. If another concurrent invocation already installed and successfully built the same package ID, the duplicate install is rejected with this error rather than re-installed. The package is already installed on the peer, so the error is informational.
Source
Thrown at core/chaincode/lifecycle/lifecycle.go:784
packageID, err := ef.Resources.ChaincodeStore.Save(pkg.Metadata.Label, chaincodeInstallPackage)
if err != nil {
return nil, errors.WithMessage(err, "could not save cc install package")
}
buildLock, cleanupBuildLocks := ef.getBuildLock(packageID)
defer cleanupBuildLocks()
buildLock.Lock()
defer buildLock.Unlock()
buildStatus, ok := ef.BuildRegistry.BuildStatus(packageID)
if ok {
// another invocation of lifecycle has concurrently
// installed a chaincode with this package id
<-buildStatus.Done()
if buildStatus.Err() == nil {
return nil, errors.Errorf("chaincode already successfully installed (package ID '%s')", packageID)
}
buildStatus = ef.BuildRegistry.ResetBuildStatus(packageID)
}
err = ef.ChaincodeBuilder.Build(packageID)
buildStatus.Notify(err)
<-buildStatus.Done()
if err := buildStatus.Err(); err != nil {
ef.Resources.ChaincodeStore.Delete(packageID)
return nil, errors.WithMessage(err, "could not build chaincode")
}
if ef.InstallListener != nil {
ef.InstallListener.HandleChaincodeInstalled(pkg.Metadata, packageID)
}
logger.Infof("Successfully installed chaincode with package ID '%s'", packageID)
return &chaincode.InstalledChaincode{View on GitHub (pinned to 2736b63f8f)
Solutions
- Ignore the error if the intent was idempotent install — the package is already installed; verify with 'peer lifecycle chaincode getinstalledpackage' or queryinstalled
- Use distinct labels for new package versions to get a new package ID
- Serialize install scripts so each peer installs each package once
- For retry logic, treat this error as success
Example fix
// before peer lifecycle chaincode install mycc.tar.gz peer lifecycle chaincode install mycc.tar.gz # -> chaincode already successfully installed (package ID '...') // after: check first if ! peer lifecycle chaincode queryinstalled | grep -q '<packageID>'; then peer lifecycle chaincode install mycc.tar.gz fi
Defensive patterns
Strategy: try-catch
Validate before calling
# Before install, check whether the package is already installed peer lifecycle chaincode queryinstalled | grep '<packageID>' || peer lifecycle chaincode install mycc.tar.gz
Try / catch
err := lifecycle.InstallChaincode(pkgBytes)
if err != nil && strings.Contains(err.Error(), "already successfully installed") {
// treat as success; package ID already present
return packageID, nil
} Prevention
- Track installed package IDs per peer in your deployment tooling
- Use unique labels per version to get distinct package IDs
- Avoid concurrent installs of the same package on one peer
- Make install steps idempotent in CI
When it happens
Trigger: Running InstallChaincode twice with the identical package content (same package ID), or concurrent/parallel installs of the same package on the same peer; the existing build completed without error so lifecycle treats re-install as a duplicate.
Common situations: Scripting install against all peers and accidentally hitting the same peer twice; CI rerun that re-installs an already-present package; parallel install jobs racing on one peer.
Related errors
- empty metadata for supplied chaincode
- query iterator not found
- application config does not exist for channel '%s'
- unknown chaincode '%s' for channel '%s'
- could not find chaincode with package id '%s'
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/785f7f8149e629f9.
Report an issue: GitHub.