kovidgoyal/kitty · error

Failed to parse response data: %#v with error: %w

Error message

Failed to parse response data: %#v with error: %w

What it means

For confirmation prompts (is_confirm), RunSSHAskpass JSON-unmarshals the SHM response into a bool. If the payload is not valid JSON boolean (e.g. "true" with quotes, empty, or garbage), this fatal error with the raw data is returned.

Source

Thrown at kittens/ssh/askpass.go:160

		return fatal(fmt.Errorf("Failed to flush SHM file with error: %w", err))
	}
	trigger_ask(data_shm.Name())
	for {
		time.Sleep(50 * time.Millisecond)
		if data_shm.Slice()[0] == 1 {
			break
		}
	}
	data, err = shm.ReadWithSize(data_shm, 1)
	if err != nil {
		return fatal(fmt.Errorf("Failed to read from SHM file with error: %w", err))
	}
	response := ""
	if is_confirm {
		var ok bool
		err = json.Unmarshal(data, &ok)
		if err != nil {
			return fatal(fmt.Errorf("Failed to parse response data: %#v with error: %w", string(data), err))
		}
		response = "no"
		if ok {
			response = "yes"
		}
	} else {
		err = json.Unmarshal(data, &response)
		if err != nil {
			return fatal(fmt.Errorf("Failed to parse response data: %#v with error: %w", string(data), err))
		}
		if is_fingerprint_check {
			response = strings.ToLower(response)
			switch response {
			case "y":
				response = "yes"
			case "n":
				response = "no"
			}

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Match kitty and kitten helper versions
  2. Ensure nothing else writes to the askpass-* SHM file
  3. Retry; if reproducible, capture the printed %#v payload and report it
Defensive patterns

Strategy: type-guard

Validate before calling

if !json.Valid(data) { /* abort */ }
var ok bool
if json.Unmarshal(data, &ok) != nil { /* reject before use */ }

Type guard

func isBoolJSON(b []byte) bool { var v bool; return json.Unmarshal(b, &v) == nil }

Prevention

When it happens

Trigger: The parent writes a non-boolean JSON payload for a confirm request, or a truncated/corrupted SHM response.

Common situations: Version mismatch between askpass helper and kitty, or memory corruption from concurrent access to the SHM file.

Understand the failure class

Related errors


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