ory/hydra · error
unsupported source `%s`
Error message
unsupported source `%s`
What it means
readFile dispatches on the URL scheme parsed from the location string. Only known schemes (file, http(s), base64, etc.) are supported; anything else falls into the default case and returns 'unsupported source'. The %s is the unrecognized scheme.
Source
Thrown at oryx/osx/file.go:216
}
return bytes, nil
}
for _, enc := range []*base64.Encoding{
base64.StdEncoding,
base64.URLEncoding,
base64.RawURLEncoding,
base64.RawStdEncoding,
} {
bytes, err = enc.DecodeString(strings.TrimPrefix(source, "base64://"))
if err == nil {
return bytes, nil
}
}
return nil, errors.Wrap(err, "unable to base64 decode the location")
default:
return nil, errors.Errorf("unsupported source `%s`", parsed.Scheme)
}
return bytes, nil
}
View on GitHub (pinned to 4174065ffb)
Solutions
- Check the scheme spelling against the supported list in osx/file.go (file, https, http, base64)
- Fix typos: 'flie://' -> 'file://'
- If the data lives in S3/Vault/etc., fetch it yourself first and pass the bytes or a temp file path
- Ensure the URL has an explicit scheme, e.g. 'file:///etc/config.yaml'
Example fix
// before
ReadFileFromAllSources("s3://bucket/config.yaml")
// after
ReadFileFromAllSources("file:///etc/oryx/config.yaml") Defensive patterns
Strategy: validation
Validate before calling
func validateSourceScheme(loc string) error {
u, err := url.Parse(loc)
if err != nil {
return err
}
switch u.Scheme {
case "file", "http", "https", "base64":
return nil
default:
return fmt.Errorf("scheme %q not supported; use file/http(s)/base64", u.Scheme)
}
} Type guard
func hasSupportedScheme(loc string) bool {
u, err := url.Parse(loc)
return err == nil && map[string]bool{"file":true,"http":true,"https":true,"base64":true}[u.Scheme]
} Try / catch
data, err := ReadFile(loc)
if err != nil && strings.Contains(err.Error(), "unsupported source") {
return fmt.Errorf("check the location scheme in %q: %w", loc, err)
} Prevention
- Always spell out an explicit supported scheme (file://, https://, base64://)
- Validate schemes at config-load time with a whitelist
- Never pass S3/Vault-style URIs to this reader; fetch them separately
- Add a startup smoke test that reads each configured location
When it happens
Trigger: Passing ReadFile/ReadFileFromAllSources a location whose URL scheme is not handled, e.g. 's3://bucket/key', 'vault://secret', 'ftp://...', or a typo like 'flie:///etc/config' or a missing scheme that parses oddly.
Common situations: Typo in scheme (flie://, file//), copying a DSN-style location (postgres://) where a file URL is expected, using a custom store scheme the library has no driver for, forgetting the scheme entirely so the path parses unexpectedly.
Related errors
- %w: in source %q: allowed schemes: %s
- could not parse the endpoint URL "%s"
- Failed to create request: %s
AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03).
Data as JSON: /api/errors/80ace2fad1082b6a.
Report an issue: GitHub.