{"record":{"id":"ae308d9073165a4b","repo":"hyperledger/fabric","slug":"error-writing-chaincode-install-package-to-s","errorCode":null,"errorMessage":"error writing chaincode install package to %s","messagePattern":"error writing chaincode install package to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/persistence/persistence.go","lineNumber":173,"sourceCode":"\t\tpanic(fmt.Sprintf(\"Could not create _lifecycle chaincodes install path: %s\", err))\n\t}\n}\n\n// Save persists chaincode install package bytes. It returns\n// the hash of the chaincode install package\nfunc (s *Store) Save(label string, ccInstallPkg []byte) (string, error) {\n\tpackageID := PackageID(label, ccInstallPkg)\n\n\tccInstallPkgFileName := CCFileName(packageID)\n\tccInstallPkgFilePath := filepath.Join(s.Path, ccInstallPkgFileName)\n\n\tif exists, _ := s.ReadWriter.Exists(ccInstallPkgFilePath); exists {\n\t\t// chaincode install package was already installed\n\t\treturn packageID, nil\n\t}\n\n\tif err := s.ReadWriter.WriteFile(s.Path, ccInstallPkgFileName, ccInstallPkg); err != nil {\n\t\terr = errors.Wrapf(err, \"error writing chaincode install package to %s\", ccInstallPkgFilePath)\n\t\tlogger.Error(err.Error())\n\t\treturn \"\", err\n\t}\n\n\treturn packageID, nil\n}\n\n// Load loads a persisted chaincode install package bytes with\n// the given packageID.\nfunc (s *Store) Load(packageID string) ([]byte, error) {\n\tccInstallPkgPath := filepath.Join(s.Path, CCFileName(packageID))\n\n\texists, err := s.ReadWriter.Exists(ccInstallPkgPath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not determine whether chaincode install package '%s' exists\", packageID)\n\t}\n\tif !exists {\n\t\treturn nil, &CodePackageNotFoundErr{","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/persistence/persistence.go#L155-L191","documentation":"Store.Save persists a chaincode install package to disk; when ReadWriter.WriteFile fails, the error is wrapped with 'error writing chaincode install package to %s' and returned to the caller. The package is not installed. Note the message reports ccInstallPkgFilePath while the write actually targets s.Path/ccInstallPkgFileName.","triggerScenarios":"Calling Save(label, ccInstallPkg) after Exists() says the package is new, but the subsequent WriteFile fails due to disk full, permission denied, or I/O error.","commonSituations":"Disk quota/full volume on the peer; install directory permissions changed after Initialize; underlying storage (NFS volume) transiently unavailable during chaincode install via lifecycle CLI/SDK.","solutions":["Free disk space or raise the volume quota on the peer's fileSystemPath","Check ownership/permissions of the _lifecycle chaincodes directory","Retry the install command after fixing storage; save is idempotent for already-installed packageIDs","Inspect the wrapped inner error in the log line for the exact OS cause"],"exampleFix":"$ df -h /var/hyperledger/production   # check space\n$ ls -ld /var/hyperledger/production/lifecycle/chaincodes","handlingStrategy":"validation","validationCode":"info, err := os.Stat(storePath)\nif err != nil { return err }\nif !info.IsDir() || unix.Access(storePath, unix.W_OK) != nil { return fmt.Errorf(\"store path %s not writable\", storePath) }","typeGuard":null,"tryCatchPattern":"packageID, err := store.Save(label, pkg)\nif err != nil {\n  if strings.Contains(err.Error(), \"error writing chaincode install package\") {\n    // inspect disk space & perms, retry\n  }\n  return err\n}","preventionTips":["Monitor disk usage on the peer volume","Keep the chaincodes dir ownership stable across upgrades","Retry idempotent Save calls on transient storage errors"],"tags":["filesystem","write-failed","fabric","chaincode-install"],"backgroundTag":"file-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"}