{"record":{"id":"785f7f8149e629f9","repo":"hyperledger/fabric","slug":"chaincode-already-successfully-installed-package","errorCode":null,"errorMessage":"chaincode already successfully installed (package ID '%s')","messagePattern":"chaincode already successfully installed \\(package ID '(.+?)'\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/chaincode/lifecycle/lifecycle.go","lineNumber":784,"sourceCode":"\n\tpackageID, err := ef.Resources.ChaincodeStore.Save(pkg.Metadata.Label, chaincodeInstallPackage)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not save cc install package\")\n\t}\n\n\tbuildLock, cleanupBuildLocks := ef.getBuildLock(packageID)\n\tdefer cleanupBuildLocks()\n\n\tbuildLock.Lock()\n\tdefer buildLock.Unlock()\n\n\tbuildStatus, ok := ef.BuildRegistry.BuildStatus(packageID)\n\tif ok {\n\t\t// another invocation of lifecycle has concurrently\n\t\t// installed a chaincode with this package id\n\t\t<-buildStatus.Done()\n\t\tif buildStatus.Err() == nil {\n\t\t\treturn nil, errors.Errorf(\"chaincode already successfully installed (package ID '%s')\", packageID)\n\t\t}\n\t\tbuildStatus = ef.BuildRegistry.ResetBuildStatus(packageID)\n\t}\n\terr = ef.ChaincodeBuilder.Build(packageID)\n\tbuildStatus.Notify(err)\n\t<-buildStatus.Done()\n\tif err := buildStatus.Err(); err != nil {\n\t\tef.Resources.ChaincodeStore.Delete(packageID)\n\t\treturn nil, errors.WithMessage(err, \"could not build chaincode\")\n\t}\n\n\tif ef.InstallListener != nil {\n\t\tef.InstallListener.HandleChaincodeInstalled(pkg.Metadata, packageID)\n\t}\n\n\tlogger.Infof(\"Successfully installed chaincode with package ID '%s'\", packageID)\n\n\treturn &chaincode.InstalledChaincode{","sourceCodeStart":766,"sourceCodeEnd":802,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/lifecycle.go#L766-L802","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\npeer lifecycle chaincode install mycc.tar.gz\npeer lifecycle chaincode install mycc.tar.gz  # -> chaincode already successfully installed (package ID '...')\n// after: check first\nif ! peer lifecycle chaincode queryinstalled | grep -q '<packageID>'; then\n  peer lifecycle chaincode install mycc.tar.gz\nfi","handlingStrategy":"try-catch","validationCode":"# Before install, check whether the package is already installed\npeer lifecycle chaincode queryinstalled | grep '<packageID>' || peer lifecycle chaincode install mycc.tar.gz","typeGuard":null,"tryCatchPattern":"err := lifecycle.InstallChaincode(pkgBytes)\nif err != nil && strings.Contains(err.Error(), \"already successfully installed\") {\n  // treat as success; package ID already present\n  return packageID, nil\n}","preventionTips":["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"],"tags":["fabric","lifecycle","install","duplicate","concurrency"],"backgroundTag":"duplicate-install","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"}