{"record":{"id":"d22b1ce821a9a788","repo":"ory/hydra","slug":"failed-to-parse-url","errorCode":null,"errorMessage":"failed to parse URL","messagePattern":"failed to parse URL","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/osx/file.go","lineNumber":151,"sourceCode":"// - https://host.com/path/to/file\n// - http://host.com/path/to/file\n// - base64://<base64 encoded string>\n//\n// For more options, check:\n//\n// - WithDisabledFileLoader\n// - WithDisabledHTTPLoader\n// - WithDisabledBase64Loader\n// - WithBase64Encoding\n// - WithHTTPClient\nfunc ReadFileFromAllSources(source string, opts ...Option) (bytes []byte, err error) {\n\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","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/osx/file.go#L133-L169","documentation":"Returned by readFile when url.Parse rejects the source string, i.e. before any scheme dispatch happens. The source itself is not a parseable URL — control characters, invalid percent-escapes, or a malformed scheme cause this. This is an input-format error in the source argument.","triggerScenarios":"Thrown at oryx/osx/file.go:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Sanitize or percent-encode the source string so net/url can parse it","Remove control characters or stray whitespace from the configured source","Validate sources with url.Parse at configuration load time"],"exampleFix":null,"handlingStrategy":"validation","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"}