kovidgoyal/kitty · error

Could not get

Error message

Could not get

What it means

While fetching an image over HTTP(S), either http.Get failed or the response status was not 200. report_error prefixes 'Could not get' to the underlying error (e.g. DNS failure, timeout, or 'bad status: 404 Not Found').

Source

Thrown at kittens/icat/process_images.go:246

	b := img.Bounds()
	f := image_frame{width: b.Dx(), height: b.Dy(), number: len(imgd.frames) + 1, left: left, top: top}
	f.transmission_format = utils.IfElse(num_channels == 3, graphics.GRT_format_rgb, graphics.GRT_format_rgba)
	f.in_memory_bytes = pix
	imgd.frames = append(imgd.frames, &f)
	return &f
}

func process_arg(arg input_arg) {
	var f opened_input
	if arg.is_http_url {
		resp, err := http.Get(arg.value)
		if err != nil {
			report_error(arg.value, "Could not get", err)
			return
		}
		defer resp.Body.Close()
		if resp.StatusCode != http.StatusOK {
			report_error(arg.value, "Could not get", fmt.Errorf("bad status: %v", resp.Status))
			return
		}
		dest := bytes.Buffer{}
		dest.Grow(64 * 1024)
		_, err = io.Copy(&dest, resp.Body)
		if err != nil {
			report_error(arg.value, "Could not download", err)
			return
		}
		f.bytes = dest.Bytes()
		f.file = bytes.NewReader(f.bytes)
	} else if arg.value == "" {
		stdin, err := io.ReadAll(os.Stdin)
		if err != nil {
			report_error("<stdin>", "Could not read from", err)
			return
		}
		f.bytes = stdin

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. curl -I the URL to check status and reachability
  2. Fix or replace the dead URL / download the image locally first
  3. Add proxy env vars (HTTPS_PROXY) if behind a corporate network
  4. Handle non-200 by downloading with retries before passing a local file to icat

Example fix

# before
kitten icat https://example.com/img.png
# after
curl -fLo /tmp/img.png https://example.com/img.png && kitten icat /tmp/img.png
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(url)
if err != nil || resp.StatusCode != 200 { /* download beforehand or skip */ }

Try / catch

if err != nil && strings.Contains(err.Error(), "bad status") { /* retry with backoff or use cached copy */ }

Prevention

When it happens

Trigger: kitten icat https://example.com/missing.png returns 404/403, or the connection fails (DNS, TLS, offline).

Common situations: Hotlinking URLs that now 404 or redirect to HTML; corporate proxy blocking the request; expired CDN links; typo in the URL scheme.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/1f692120ee4dc076. Report an issue: GitHub.