{"record":{"id":"df8a423f15bb2670","repo":"nats-io/nats-server","slug":"error-accessing-path-s-v","errorCode":null,"errorMessage":"error accessing path [%s]: %v","messagePattern":"error accessing path \\[(.+?)\\]: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/dirstore.go","lineNumber":55,"sourceCode":")\n\n// validatePathExists checks that the provided path exists and is a dir if requested\nfunc validatePathExists(path string, dir bool) (string, error) {\n\tif path == _EMPTY_ {\n\t\treturn _EMPTY_, errors.New(\"path is not specified\")\n\t}\n\n\tabs, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn _EMPTY_, fmt.Errorf(\"error parsing path [%s]: %v\", abs, err)\n\t}\n\n\tvar finfo os.FileInfo\n\tif finfo, err = os.Stat(abs); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn _EMPTY_, fmt.Errorf(\"the path [%s] doesn't exist\", abs)\n\t\t}\n\t\treturn _EMPTY_, fmt.Errorf(\"error accessing path [%s]: %v\", abs, err)\n\t}\n\n\tmode := finfo.Mode()\n\tif dir && mode.IsRegular() {\n\t\treturn _EMPTY_, fmt.Errorf(\"the path [%s] is not a directory\", abs)\n\t}\n\n\tif !dir && mode.IsDir() {\n\t\treturn _EMPTY_, fmt.Errorf(\"the path [%s] is not a file\", abs)\n\t}\n\n\treturn abs, nil\n}\n\n// ValidateDirPath checks that the provided path exists and is a dir\nfunc validateDirPath(path string) (string, error) {\n\treturn validatePathExists(path, true)\n}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/dirstore.go#L37-L73","documentation":"Directory JWT store path validation: os.Stat failed with an error other than not-exist (e.g. permission denied on a parent directory), so existence could not even be determined for the path.","triggerScenarios":"Thrown at server/dirstore.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check filesystem permissions on the path and its parents","Mount or repair the affected filesystem","Run the server with sufficient privileges to stat the path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}