ory/hydra · error
unable to read the file
Error message
unable to read the file
What it means
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.
Source
Thrown at oryx/osx/file.go:163
return readFile(source, newOptions().apply(opts))
}
func readFile(source string, o *options) (bytes []byte, err error) {
parsed, err := url.Parse(source)
if err != nil {
return nil, errors.Wrap(err, "failed to parse URL")
}
switch parsed.Scheme {
case "":
if o.disableFileLoader {
return nil, errors.New("file loader disabled")
}
//#nosec G304 -- false positive
bytes, err = os.ReadFile(source)
if err != nil {
return nil, errors.Wrap(err, "unable to read the file")
}
case "file":
if o.disableFileLoader {
return nil, errors.New("file loader disabled")
}
//#nosec G304 -- false positive
bytes, err = os.ReadFile(parsed.Host + parsed.Path)
if err != nil {
return nil, errors.Wrap(err, "unable to read the file")
}
case "http", "https":
if o.disableHTTPLoader {
return nil, errors.New("http(s) loader disabled")
}
resp, err := o.hc.Get(parsed.String())
if err != nil {
return nil, errors.Wrap(err, "unable to load remote file")View on GitHub (pinned to 4174065ffb)
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at oryx/osx/file.go:163 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03).
Data as JSON: /api/errors/ad878a87122b25c7.
Report an issue: GitHub.