hyperledger/fabric · error
error reading chaincode install package at %s
Error message
error reading chaincode install package at %s
What it means
Store.Load successfully confirmed the package file exists but ReadWriter.ReadFile failed reading it; the error is wrapped with 'error reading chaincode install package at %s'. The launch/build of the chaincode fails.
Source
Thrown at core/chaincode/persistence/persistence.go:198
// Load loads a persisted chaincode install package bytes with
// the given packageID.
func (s *Store) Load(packageID string) ([]byte, error) {
ccInstallPkgPath := filepath.Join(s.Path, CCFileName(packageID))
exists, err := s.ReadWriter.Exists(ccInstallPkgPath)
if err != nil {
return nil, errors.Wrapf(err, "could not determine whether chaincode install package '%s' exists", packageID)
}
if !exists {
return nil, &CodePackageNotFoundErr{
PackageID: packageID,
}
}
ccInstallPkg, err := s.ReadWriter.ReadFile(ccInstallPkgPath)
if err != nil {
err = errors.Wrapf(err, "error reading chaincode install package at %s", ccInstallPkgPath)
return nil, err
}
return ccInstallPkg, nil
}
// Delete deletes a persisted chaincode. Note, there is no locking,
// so this should only be performed if the chaincode has already
// been marked built.
func (s *Store) Delete(packageID string) error {
ccInstallPkgPath := filepath.Join(s.Path, CCFileName(packageID))
return s.ReadWriter.Remove(ccInstallPkgPath)
}
// CodePackageNotFoundErr is the error returned when a code package cannot
// be found in the persistence store
type CodePackageNotFoundErr struct {
PackageID stringView on GitHub (pinned to 2736b63f8f)
Solutions
- Fix read permissions on the package file/dir for the peer user
- Re-install the chaincode package (peer lifecycle chaincode install) to rewrite a corrupt/truncated file
- Check storage health (disk errors, NFS state) in the wrapped cause
- Restore from backup if the package was damaged by admin tooling
Example fix
// before (corrupt file) $ peer lifecycle chaincode queryinstalled # works, but build fails // after $ peer lifecycle chaincode install repaired-pkg.tgz
Defensive patterns
Strategy: validation
Validate before calling
p := filepath.Join(storePath, persistence.CCFileName(packageID))
f, err := os.Open(p); if err != nil { return err }; defer f.Close()
if _, err := io.ReadFull(f, make([]byte, 1)); err != nil { return fmt.Errorf("unreadable: %w", err) } Try / catch
pkg, err := store.Load(packageID)
if err != nil && strings.Contains(err.Error(), "error reading chaincode install package") {
// repair by re-installing the package
} Prevention
- Avoid manual file manipulation inside the chaincodes directory
- Re-install packages after backup restores
- Keep peer user ownership on package files
When it happens
Trigger: Calling Load(packageID) when the file exists per Exists() but open/read fails: permission change between check and read, corrupted storage, truncated file on a full disk.
Common situations: File perms altered by backup/restore tooling; partially written package after an earlier disk-full save; NFS stale handle on network storage.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- chaincode %s exists
- error opening block file %s
- error seeking block file [%s] to startOffset [%d]
- error getting block file stat
- error reading dir %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/7f83ee6a45cdf464.
Report an issue: GitHub.