{"record":{"id":"492872ab799b5855","repo":"hyperledger/fabric","slug":"path-to-chaincode-does-not-exist-s","errorCode":null,"errorMessage":"path to chaincode does not exist: %s","messagePattern":"path to chaincode does not exist: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/node/platform.go","lineNumber":67,"sourceCode":"func (p *Platform) ValidatePath(rawPath string) error {\n\tpath, err := url.Parse(rawPath)\n\tif err != nil || path == nil {\n\t\treturn fmt.Errorf(\"invalid path: %s\", err)\n\t}\n\n\t// Treat empty scheme as a local filesystem path\n\tif path.Scheme == \"\" {\n\t\tpathToCheck, err := filepath.Abs(rawPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error obtaining absolute path of the chaincode: %s\", err)\n\t\t}\n\n\t\texists, err := pathExists(pathToCheck)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error validating chaincode path: %s\", err)\n\t\t}\n\t\tif !exists {\n\t\t\treturn fmt.Errorf(\"path to chaincode does not exist: %s\", rawPath)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *Platform) ValidateCodePackage(code []byte) error {\n\t// FAB-2122: Scan the provided tarball to ensure it only contains source-code under\n\t// the src folder.\n\t//\n\t// It should be noted that we cannot catch every threat with these techniques.  Therefore,\n\t// the container itself needs to be the last line of defense and be configured to be\n\t// resilient in enforcing constraints. However, we should still do our best to keep as much\n\t// garbage out of the system as possible.\n\tre := regexp.MustCompile(`^(/)?(src|META-INF)/.*`)\n\tis := bytes.NewReader(code)\n\tgr, err := gzip.NewReader(is)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failure opening codepackage gzip stream: %s\", err)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/node/platform.go#L49-L85","documentation":"For a scheme-less path, ValidatePath requires that the local chaincode directory actually exists on the peer's filesystem. If pathExists reports the path does not exist, this error names the raw path that was supplied.","triggerScenarios":"ValidatePath called with a scheme-less path pointing to a directory that is not present on the machine running validation (note: this is the node platform, so a Go-path with a scheme like github.com/... is accepted, but a bare non-existent local path fails).","commonSituations":"Chaincode source not deployed/pulled to the peer host; typo in the path; running in a container where the source directory was not volume-mounted; switching between hosts where paths differ.","solutions":["Verify the path exists on the validating host (ls the directory) and fix typos","Mount or copy the chaincode source into the peer/container filesystem","Use a URL-style path (with scheme) if the code lives in a VCS and is fetched remotely"],"exampleFix":"// before\nerr := platform.ValidatePath(\"/opt/chaincode/node/mycc\") // not present in container\n// after\n# docker run -v /opt/chaincode/node/mycc:/opt/chaincode/node/mycc ...\nerr := platform.ValidatePath(\"/opt/chaincode/node/mycc\")","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(rawPath); os.IsNotExist(err) { return fmt.Errorf(\"%q missing on host\", rawPath) }","typeGuard":null,"tryCatchPattern":"if err := platform.ValidatePath(rawPath); err != nil && strings.Contains(err.Error(), \"does not exist\") {\n    // mount source or correct the path\n}","preventionTips":["Verify existence on the validating host","Volume-mount sources in containers","Check path spelling"],"tags":["chaincode","node","filesystem","path"],"backgroundTag":"chaincode-path-not-found","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"}