kovidgoyal/kitty · error

%s: %w

Error message

%s: %w

What it means

report_error is icat's generic per-image error wrapper: it formats '<msg>: <err>' into the image's result and forwards it to the output channel. Seeing this message means an image failed during processing and this is the prefix of the underlying cause.

Source

Thrown at kittens/icat/process_images.go:152

		switch fit_mode {
		case fit_none:
			imgd.available_width, imgd.available_height = inf, inf
		case fit_both:
			imgd.available_width = int(screen_size.Xpixel)
			imgd.available_height = int(screen_size.Ypixel)
		case fit_width:
			imgd.available_width = int(screen_size.Xpixel)
			imgd.available_height = inf
		case fit_height:
			imgd.available_width = inf
			imgd.available_height = int(screen_size.Ypixel)
		}
	}
	imgd.needs_scaling = imgd.canvas_width > imgd.available_width || imgd.canvas_height > imgd.available_height || opts.ScaleUp
}

func report_error(source_name, msg string, err error) {
	imgd := image_data{source_name: source_name, err: fmt.Errorf("%s: %w", msg, err)}
	send_output(&imgd)
}

func make_output_from_input(imgd *image_data, f *opened_input) {
	frame := image_frame{}
	imgd.frames = append(imgd.frames, &frame)
	frame.width = imgd.canvas_width
	frame.height = imgd.canvas_height
	if imgd.format_uppercase != "PNG" {
		panic(fmt.Sprintf("Unknown transmission format: %s", imgd.format_uppercase))
	}
	frame.transmission_format = graphics.GRT_format_png
	if f.bytes != nil {
		frame.in_memory_bytes = f.bytes
	} else if f.path != "" {
		frame.filename = f.path
	} else {
		var err error

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Read the wrapped error after the colon to identify the real cause
  2. Validate/preview inputs (HTTP reachability, file readability, image decodability) before batch runs
  3. Retry with a single image to isolate the failing one
Defensive patterns

Strategy: try-catch

Try / catch

if imgd.err != nil && strings.HasPrefix(imgd.err.Error(), "Could not get") { /* handle fetch failure, skip image */ }

Prevention

When it happens

Trigger: Any of the per-image failure paths in process_arg (HTTP fetch failure, decode failure, file read failure) funnels through report_error(arg.value, msg, err).

Common situations: Batch-displaying images where one URL/file is bad; the real cause is in the wrapped %w — read the suffix of the message.

Related errors


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