{"record":{"id":"38d574af70c843f3","repo":"hyperledger/fabric","slug":"error-installing-chaincode-code-s-s-s","errorCode":null,"errorMessage":"error installing chaincode code %s:%s(%s)","messagePattern":"error installing chaincode code (.+?):(.+?)\\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/scc/lscc/support.go","lineNumber":28,"sourceCode":"\tpb \"github.com/hyperledger/fabric-protos-go-apiv2/peer\"\n\t\"github.com/hyperledger/fabric/common/cauthdsl\"\n\t\"github.com/hyperledger/fabric/common/policydsl\"\n\t\"github.com/hyperledger/fabric/core/common/ccprovider\"\n\t\"github.com/hyperledger/fabric/msp\"\n\t\"github.com/hyperledger/fabric/protoutil\"\n\t\"github.com/pkg/errors\"\n)\n\ntype SupportImpl struct {\n\tGetMSPIDs               MSPIDsGetter\n\tGetIdentityDeserializer func(chainID string) msp.IdentityDeserializer\n}\n\n// PutChaincodeToLocalStorage stores the supplied chaincode\n// package to local storage (i.e. the file system)\nfunc (s *SupportImpl) PutChaincodeToLocalStorage(ccpack ccprovider.CCPackage) error {\n\tif err := ccpack.PutChaincodeToFS(); err != nil {\n\t\treturn errors.Errorf(\"error installing chaincode code %s:%s(%s)\", ccpack.GetChaincodeData().Name, ccpack.GetChaincodeData().Version, err)\n\t}\n\n\treturn nil\n}\n\n// GetChaincodeFromLocalStorage retrieves the chaincode package\n// for the requested chaincode, specified by name and version\nfunc (s *SupportImpl) GetChaincodeFromLocalStorage(ccNameVersion string) (ccprovider.CCPackage, error) {\n\treturn ccprovider.GetChaincodeFromFS(ccNameVersion)\n}\n\n// GetChaincodesFromLocalStorage returns an array of all chaincode\n// data that have previously been persisted to local storage\nfunc (s *SupportImpl) GetChaincodesFromLocalStorage() (*pb.ChaincodeQueryResponse, error) {\n\treturn ccprovider.GetInstalledChaincodes()\n}\n\n// GetInstantiationPolicy returns the instantiation policy for the","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/scc/lscc/support.go#L10-L46","documentation":"PutChaincodeToLocalStorage wraps any failure from ccpack.PutChaincodeToFS() with the chaincode name, version, and underlying error. It occurs when the installed chaincode package cannot be written to the peer's local file system (the chaincode install path), so `peer chaincode install` fails on this peer.","triggerScenarios":"Calling SupportImpl.PutChaincodeToLocalStorage during `peer chaincode install` when PutChaincodeToFS fails: no write permission on the peer's chaincode directory, disk full, invalid/nil chaincode data in the package, or an unreadable/corrupt .tar.gz package.","commonSituations":"Peer running as a different user (Docker volume permission mismatch) so /var/hyperledger/production/chaincodes is unwritable; host disk full; installing a package built with mismatched metadata; Kubernetes/hostPath mounts with wrong fsGroup.","solutions":["Check and fix permissions on the peer's chaincode install directory (CORE_CHAINCODE_INSTALL_PATH, default /var/hyperledger/production/chaincodes) so the peer process user can write.","Free disk space on the peer's volume (df -h) if the filesystem is full.","Rebuild/repackage the chaincode and retry `peer chaincode install` to rule out a corrupt package.","Inspect the wrapped cause in the message (the third %s) to address the specific filesystem or package error."],"exampleFix":"// before: permission denied writing package\nerror installing chaincode code mycc:1.0(chmod /var/hyperledger/production/chaincodes/mycc.1.0: permission denied)\n// after: fix ownership of the install dir\ndocker exec peer0 chown -R $(id -u):$(id -g) /var/hyperledger/production/chaincodes\n# or set the volume fsGroup in the peer deployment","handlingStrategy":"validation","validationCode":"// preflight: ensure the peer's install dir is writable and has space\npath := \"/var/hyperledger/production/chaincodes\"\nif fi, err := os.Stat(path); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"install path %s missing: %w\", path, err)\n}\nprobe := filepath.Join(path, \".writecheck\")\nif err := os.WriteFile(probe, []byte(\"ok\"), 0o600); err != nil {\n    return fmt.Errorf(\"install path %s not writable: %w\", path, err)\n}\nos.Remove(probe)","typeGuard":null,"tryCatchPattern":"// Go: inspect the wrapped cause in the install error\nif err := installChaincode(...); err != nil {\n    var fsErr *os.PathError\n    if errors.As(err, &fsErr) {\n        return fmt.Errorf(\"fix filesystem/permissions for %s: %w\", fsErr.Path, fsErr.Err)\n    }\n    return err\n}","preventionTips":["Run the peer container with a user that owns the chaincodes volume; set fsGroup on Kubernetes hostPath/PV mounts.","Alert on disk usage of the peer's data volume (chaincode installs consume space per version).","Validate chaincode packages (name/version metadata) before distributing to peers.","Retry installs per-peer after fixing the root cause rather than skipping peers."],"tags":["hyperledger-fabric","chaincode-install","filesystem","permissions"],"backgroundTag":"filesystem-write-failed","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"}