{"record":{"id":"02ded5466981d610","repo":"charmbracelet/glow","slug":"s-is-not-a-supported-protocol","errorCode":null,"errorMessage":"%s is not a supported protocol","messagePattern":"(.+?) is not a supported protocol","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":91,"sourceCode":"// sourceFromArg parses an argument and creates a readable source for it.\nfunc sourceFromArg(arg string) (*source, error) {\n\t// from stdin\n\tif arg == \"-\" {\n\t\treturn &source{reader: os.Stdin}, nil\n\t}\n\n\t// a GitHub or GitLab URL (even without the protocol):\n\tsrc, err := readmeURL(arg)\n\tif src != nil && err == nil {\n\t\t// if there's an error, try next methods...\n\t\treturn src, nil\n\t}\n\n\t// HTTP(S) URLs:\n\tif u, err := url.ParseRequestURI(arg); err == nil && strings.Contains(arg, \"://\") { //nolint:nestif\n\t\tif u.Scheme != \"\" {\n\t\t\tif u.Scheme != \"http\" && u.Scheme != \"https\" {\n\t\t\t\treturn nil, fmt.Errorf(\"%s is not a supported protocol\", u.Scheme)\n\t\t\t}\n\t\t\t// consumer of the source is responsible for closing the ReadCloser.\n\t\t\tresp, err := http.Get(u.String()) //nolint: noctx,bodyclose\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to get url: %w\", err)\n\t\t\t}\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\treturn nil, fmt.Errorf(\"HTTP status %d\", resp.StatusCode)\n\t\t\t}\n\t\t\treturn &source{resp.Body, u.String()}, nil\n\t\t}\n\t}\n\n\t// a directory:\n\tif len(arg) == 0 {\n\t\t// use the current working dir if no argument was supplied\n\t\targ = \".\"\n\t}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/main.go#L73-L109","documentation":"When an argument parses as an absolute URI (url.ParseRequestURI succeeds and it contains \"://\") but the scheme is neither http nor https, glow rejects it with this message. Only plain http(s) URLs, GitHub/GitLab shorthands, local files, and directories are supported sources. So file://, ftp://, ssh://, gopher:// and similar schemes never reach the fetch stage.","triggerScenarios":"Passing file:///path/to/readme.md, ftp://, gemini://, ssh:// or any other scheme; URI-shaped input where the scheme segment is unexpected; Windows drive-letter paths that parse with a scheme-like prefix.","commonSituations":"Users assuming file:// URLs work, copy-pasted links with a mistyped scheme (htpt://), Windows path quirks being interpreted as a scheme.","solutions":["Drop the protocol and pass a plain local path: glow /path/to/README.md","Use an http(s) URL for remote documents","Double-check the scheme spelling in the pasted URL"],"exampleFix":"// before\nglow file:///home/user/README.md\n\n// after\nglow /home/user/README.md","handlingStrategy":"validation","validationCode":"func supportedScheme(arg string) bool {\n\tif !strings.Contains(arg, \"://\") { return true }\n\tu, err := url.ParseRequestURI(arg)\n\tif err != nil || u.Scheme == \"\" { return true }\n\treturn u.Scheme == \"http\" || u.Scheme == \"https\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the scheme before handing a URL-shaped argument to glow","Convert file:// URLs to plain paths at your call site","Document that only http(s), GitHub/GitLab URLs, files and directories are supported sources"],"tags":["url","validation","cli-input"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}