{"record":{"id":"64eb2ee534cb72b9","repo":"hyperledger/fabric","slug":"listing-deps-for-package-s-failed","errorCode":null,"errorMessage":"listing deps for package %s failed","messagePattern":"listing deps for package (.+?) failed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/golang/list.go","lineNumber":90,"sourceCode":"\tfor {\n\t\tvar packageInfo PackageInfo\n\t\tif err := decoder.Decode(&packageInfo); errors.Is(err, io.EOF) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif packageInfo.Incomplete {\n\t\t\treturn nil, fmt.Errorf(\"failed to calculate dependencies: incomplete package: %s\", packageInfo.ImportPath)\n\t\t}\n\t\tif !packageInfo.Goroot {\n\t\t\tlist = append(list, packageInfo)\n\t\t}\n\t}\n\n\terr = cmd.Wait()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"listing deps for package %s failed\", pkg)\n\t}\n\n\treturn list, nil\n}\n\nfunc wrapExitErr(err error, message string) error {\n\tif ee, ok := err.(*exec.ExitError); ok {\n\t\treturn errors.Wrapf(err, message+\" with: %s\", strings.TrimRight(string(ee.Stderr), \"\\n\\r\\t\"))\n\t}\n\treturn errors.Wrap(err, message)\n}\n\ntype ModuleInfo struct {\n\tDir        string\n\tGoMod      string\n\tImportPath string\n\tModulePath string\n}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/golang/list.go#L72-L108","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// chaincode with broken import\nimport \"github.com/me/lib\"  // not in go.mod\n// after\n$ go get github.com/me/lib && go mod vendor","handlingStrategy":"validation","validationCode":"cmd := exec.Command(\"go\", \"list\", \"./...\")\nif out, err := cmd.CombinedOutput(); err != nil {\n  return fmt.Errorf(\"go list failed: %v: %s\", err, out)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["golang","go-list","chaincode-build","fabric"],"backgroundTag":"go-list-failed","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}