charmbracelet/glow · error

%s is not a supported protocol

Error message

%s is not a supported protocol

What it means

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.

Source

Thrown at main.go:91

// sourceFromArg parses an argument and creates a readable source for it.
func sourceFromArg(arg string) (*source, error) {
	// from stdin
	if arg == "-" {
		return &source{reader: os.Stdin}, nil
	}

	// a GitHub or GitLab URL (even without the protocol):
	src, err := readmeURL(arg)
	if src != nil && err == nil {
		// if there's an error, try next methods...
		return src, nil
	}

	// HTTP(S) URLs:
	if u, err := url.ParseRequestURI(arg); err == nil && strings.Contains(arg, "://") { //nolint:nestif
		if u.Scheme != "" {
			if u.Scheme != "http" && u.Scheme != "https" {
				return nil, fmt.Errorf("%s is not a supported protocol", u.Scheme)
			}
			// consumer of the source is responsible for closing the ReadCloser.
			resp, err := http.Get(u.String()) //nolint: noctx,bodyclose
			if err != nil {
				return nil, fmt.Errorf("unable to get url: %w", err)
			}
			if resp.StatusCode != http.StatusOK {
				return nil, fmt.Errorf("HTTP status %d", resp.StatusCode)
			}
			return &source{resp.Body, u.String()}, nil
		}
	}

	// a directory:
	if len(arg) == 0 {
		// use the current working dir if no argument was supplied
		arg = "."
	}

View on GitHub (pinned to e3970c813d)

Solutions

  1. Drop the protocol and pass a plain local path: glow /path/to/README.md
  2. Use an http(s) URL for remote documents
  3. Double-check the scheme spelling in the pasted URL

Example fix

// before
glow file:///home/user/README.md

// after
glow /home/user/README.md
Defensive patterns

Strategy: validation

Validate before calling

func supportedScheme(arg string) bool {
	if !strings.Contains(arg, "://") { return true }
	u, err := url.ParseRequestURI(arg)
	if err != nil || u.Scheme == "" { return true }
	return u.Scheme == "http" || u.Scheme == "https"
}

Prevention

When it happens

Trigger: 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.

Common situations: Users assuming file:// URLs work, copy-pasted links with a mistyped scheme (htpt://), Windows path quirks being interpreted as a scheme.

Related errors


AI-assisted analysis of charmbracelet/glow@e3970c813d (2026-08-15). Data as JSON: /api/errors/02ded5466981d610. Report an issue: GitHub.