hyperledger/fabric · error
listing deps for package %s failed
Error message
listing deps for package %s failed
What it means
gopathDependencyPackageInfo wraps the exit error of the spawned 'go list' command with 'listing deps for package %s failed'. The go toolchain itself exited non-zero while computing the dependency list, so dependency walking for the package fails.
Source
Thrown at core/chaincode/platforms/golang/list.go:90
for {
var packageInfo PackageInfo
if err := decoder.Decode(&packageInfo); errors.Is(err, io.EOF) {
break
} else if err != nil {
return nil, err
}
if packageInfo.Incomplete {
return nil, fmt.Errorf("failed to calculate dependencies: incomplete package: %s", packageInfo.ImportPath)
}
if !packageInfo.Goroot {
list = append(list, packageInfo)
}
}
err = cmd.Wait()
if err != nil {
return nil, errors.Wrapf(err, "listing deps for package %s failed", pkg)
}
return list, nil
}
func wrapExitErr(err error, message string) error {
if ee, ok := err.(*exec.ExitError); ok {
return errors.Wrapf(err, message+" with: %s", strings.TrimRight(string(ee.Stderr), "\n\r\t"))
}
return errors.Wrap(err, message)
}
type ModuleInfo struct {
Dir string
GoMod string
ImportPath string
ModulePath string
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Read the wrapped go stderr in the error to see go's own message
- Fix compile/import errors in the chaincode package ('go build ./...')
- Align the Go toolchain version used by the peer builder with the chaincode requirements
- Ensure the package directory is a valid Go package with a .go file at the expected path
Example fix
// chaincode with broken import import "github.com/me/lib" // not in go.mod // after $ go get github.com/me/lib && go mod vendor
Defensive patterns
Strategy: validation
Validate before calling
cmd := exec.Command("go", "list", "./...")
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("go list failed: %v: %s", err, out)
} Prevention
- Pin a supported Go toolchain in the builder image
- Scrub GOFLAGS/GO111MODULE env in build containers
- Compile-check chaincode before install
- Ensure the package path contains valid Go sources
When it happens
Trigger: cmd.Wait() returns non-zero after 'go list -deps -json ...' runs on the chaincode package — compile errors in scanned deps, bad GOFLAGS/GO111MODULE env, or go binary issues in the peer environment.
Common situations: Chaincode source does not compile (syntax/type errors) causing go list to fail; incompatible Go version in the peer vs chaincode; GO111MODULE/go env conflicts in the builder container.
Related errors
- failed to calculate dependencies: incomplete package: %s
- with: %s
- failed to unmarshal output from 'go list'
- too few arguments
- chaincode type not supported: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/64eb2ee534cb72b9.
Report an issue: GitHub.