{"record":{"id":"80ace2fad1082b6a","repo":"ory/hydra","slug":"unsupported-source-s","errorCode":null,"errorMessage":"unsupported source `%s`","messagePattern":"unsupported source `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/osx/file.go","lineNumber":216,"sourceCode":"\t\t\t}\n\t\t\treturn bytes, nil\n\t\t}\n\n\t\tfor _, enc := range []*base64.Encoding{\n\t\t\tbase64.StdEncoding,\n\t\t\tbase64.URLEncoding,\n\t\t\tbase64.RawURLEncoding,\n\t\t\tbase64.RawStdEncoding,\n\t\t} {\n\t\t\tbytes, err = enc.DecodeString(strings.TrimPrefix(source, \"base64://\"))\n\t\t\tif err == nil {\n\t\t\t\treturn bytes, nil\n\t\t\t}\n\t\t}\n\n\t\treturn nil, errors.Wrap(err, \"unable to base64 decode the location\")\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unsupported source `%s`\", parsed.Scheme)\n\t}\n\n\treturn bytes, nil\n\n}\n","sourceCodeStart":198,"sourceCodeEnd":222,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/osx/file.go#L198-L222","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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'"],"exampleFix":"// before\nReadFileFromAllSources(\"s3://bucket/config.yaml\")\n// after\nReadFileFromAllSources(\"file:///etc/oryx/config.yaml\")","handlingStrategy":"validation","validationCode":"func validateSourceScheme(loc string) error {\n    u, err := url.Parse(loc)\n    if err != nil {\n        return err\n    }\n    switch u.Scheme {\n    case \"file\", \"http\", \"https\", \"base64\":\n        return nil\n    default:\n        return fmt.Errorf(\"scheme %q not supported; use file/http(s)/base64\", u.Scheme)\n    }\n}","typeGuard":"func hasSupportedScheme(loc string) bool {\n    u, err := url.Parse(loc)\n    return err == nil && map[string]bool{\"file\":true,\"http\":true,\"https\":true,\"base64\":true}[u.Scheme]\n}","tryCatchPattern":"data, err := ReadFile(loc)\nif err != nil && strings.Contains(err.Error(), \"unsupported source\") {\n    return fmt.Errorf(\"check the location scheme in %q: %w\", loc, err)\n}","preventionTips":["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"],"tags":["url","scheme","unsupported"],"backgroundTag":"unsupported-scheme","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"}