{"record":{"id":"c4a886d09e2830e2","repo":"hyperledger/fabric","slug":"walk-failed","errorCode":null,"errorMessage":"walk failed","messagePattern":"walk failed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/golang/platform.go","lineNumber":522,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\t\tcase cd.Module:\n\t\t\tname = filepath.Join(\"src\", name)\n\t\tdefault:\n\t\t\t// skip top level go.mod and go.sum when not in module mode\n\t\t\tif name == \"go.mod\" || name == \"go.sum\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tname = filepath.Join(\"src\", cd.Path, name)\n\t\t}\n\n\t\tname = filepath.ToSlash(name)\n\t\tsources[name] = SourceDescriptor{Name: name, Path: path}\n\t\treturn nil\n\t}\n\n\tif err := filepath.Walk(cd.Source, walkFn); err != nil {\n\t\treturn nil, errors.Wrap(err, \"walk failed\")\n\t}\n\n\treturn sources, nil\n}\n\nfunc validateMetadata(name, path string) error {\n\tcontents, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Validate metadata file for inclusion in tar\n\t// Validation is based on the passed filename with path\n\terr = ccmetadata.ValidateMetadataFile(filepath.ToSlash(name), contents)\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/golang/platform.go#L504-L540","documentation":"Returned by findSource when filepath.Walk over the chaincode source directory returns an error — the tree traversal itself failed (unreadable directory, vanished files), not merely an excluded file. Collected sources are discarded and the walk error is wrapped.","triggerScenarios":"Calling GetDeploymentPayload (which calls findSource) when the source tree cannot be traversed: permission denied on a directory, source path missing mid-walk, or the walkFn returning an error such as 607.","commonSituations":"Unreadable subdirectories due to permissions, source directory removed while packaging, symlink cycles or escaping symlinks breaking relative path computation.","solutions":["Check the wrapped underlying error for the exact failing path.","Fix filesystem permissions so the peer process can read the entire chaincode tree.","Remove symlinks that point outside the source root.","Verify the chaincode path exists before calling GetDeploymentPayload."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(path); err != nil || !fi.IsDir() {\n\treturn fmt.Errorf(\"chaincode path missing or not a directory: %s\", path)\n}","typeGuard":null,"tryCatchPattern":"payload, err := platform.GetDeploymentPayload(path, code)\nif err != nil {\n\tif strings.Contains(err.Error(), \"walk failed\") {\n\t\t// read wrapped cause; fix permissions or missing path\n\t}\n}","preventionTips":["Verify the chaincode directory exists and is readable before packaging","chmod -R a+rX the chaincode tree for the peer user","Avoid symlink cycles in source trees"],"tags":["chaincode","filesystem","walk","hyperledger-fabric"],"backgroundTag":"source-tree-walk-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"}