{"record":{"id":"ad878a87122b25c7","repo":"ory/hydra","slug":"unable-to-read-the-file","errorCode":null,"errorMessage":"unable to read the file","messagePattern":"unable to read the file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/osx/file.go","lineNumber":163,"sourceCode":"\treturn readFile(source, newOptions().apply(opts))\n}\n\nfunc readFile(source string, o *options) (bytes []byte, err error) {\n\tparsed, err := url.Parse(source)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to parse URL\")\n\t}\n\n\tswitch parsed.Scheme {\n\tcase \"\":\n\t\tif o.disableFileLoader {\n\t\t\treturn nil, errors.New(\"file loader disabled\")\n\t\t}\n\n\t\t//#nosec G304 -- false positive\n\t\tbytes, err = os.ReadFile(source)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to read the file\")\n\t\t}\n\tcase \"file\":\n\t\tif o.disableFileLoader {\n\t\t\treturn nil, errors.New(\"file loader disabled\")\n\t\t}\n\n\t\t//#nosec G304 -- false positive\n\t\tbytes, err = os.ReadFile(parsed.Host + parsed.Path)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to read the file\")\n\t\t}\n\tcase \"http\", \"https\":\n\t\tif o.disableHTTPLoader {\n\t\t\treturn nil, errors.New(\"http(s) loader disabled\")\n\t\t}\n\t\tresp, err := o.hc.Get(parsed.String())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to load remote file\")","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/osx/file.go#L145-L181","documentation":"Returned by readFile when os.ReadFile fails for a schemeless (bare path) source. The local file does not exist, is not readable, or is a directory; the wrapped error carries the underlying *fs.PathError with the OS-level cause.","triggerScenarios":"Thrown at oryx/osx/file.go:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the path exists and the process has read permission","Fix typos or wrong working-directory-relative paths in the configuration","For ephemeral files, ensure they are generated before being read"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}