{"record":{"id":"d2224bd3ccbe62ec","repo":"hyperledger/fabric","slug":"invalid-path-s-d2224b","errorCode":null,"errorMessage":"invalid path: %s","messagePattern":"invalid path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/platforms/node/platform.go","lineNumber":52,"sourceCode":"\tif err == nil {\n\t\treturn true, nil\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\treturn true, err\n}\n\n// Name returns the name of this platform\nfunc (p *Platform) Name() string {\n\treturn pb.ChaincodeSpec_NODE.String()\n}\n\n// ValidatePath validates Go chaincodes\nfunc (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","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/platforms/node/platform.go#L34-L70","documentation":"Node platform ValidatePath guard: url.Parse failed on the raw chaincode path (or returned nil), meaning the path string is not even parseable as a URL — malformed characters or formatting in the path.","triggerScenarios":"Calling ValidatePath with a string that url.Parse rejects (control characters, malformed URL syntax such as unescaped characters) or that causes a nil result.","commonSituations":"Paths containing raw spaces or special characters pasted from shell output; a config value with embedded newlines; URLs like 'http://' with missing host in older parsers; non-ASCII bytes that break parsing.","solutions":["Pass a simple filesystem path (e.g. /path/to/chaincode) or a well-formed URL","Escape or remove special characters (spaces, control chars) from the path","Trim whitespace/newlines from the configured path value"],"exampleFix":"// before\npath := \"/opt/my apps/chaincode\\n\"\nerr := platform.ValidatePath(path)\n// after\npath := \"/opt/my-apps/chaincode\"\nerr := platform.ValidatePath(path)","handlingStrategy":"validation","validationCode":"if _, err := url.Parse(rawPath); err != nil { return fmt.Errorf(\"unparseable path: %v\", err) }","typeGuard":null,"tryCatchPattern":"if err := platform.ValidatePath(rawPath); err != nil && strings.Contains(err.Error(), \"invalid path\") {\n    // sanitize special characters and revalidate\n}","preventionTips":["Keep paths free of control characters and raw specials","Trim config whitespace before use"],"tags":["chaincode","node","url-parse","path"],"backgroundTag":"invalid-chaincode-path","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"}