{"record":{"id":"5722036bc340367c","repo":"kovidgoyal/kitty","slug":"failed-to-parse-response-data-v-with-error-w","errorCode":null,"errorMessage":"Failed to parse response data: %#v with error: %w","messagePattern":"Failed to parse response data: %#v with error: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/ssh/askpass.go","lineNumber":160,"sourceCode":"\t\treturn fatal(fmt.Errorf(\"Failed to flush SHM file with error: %w\", err))\n\t}\n\ttrigger_ask(data_shm.Name())\n\tfor {\n\t\ttime.Sleep(50 * time.Millisecond)\n\t\tif data_shm.Slice()[0] == 1 {\n\t\t\tbreak\n\t\t}\n\t}\n\tdata, err = shm.ReadWithSize(data_shm, 1)\n\tif err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to read from SHM file with error: %w\", err))\n\t}\n\tresponse := \"\"\n\tif is_confirm {\n\t\tvar ok bool\n\t\terr = json.Unmarshal(data, &ok)\n\t\tif err != nil {\n\t\t\treturn fatal(fmt.Errorf(\"Failed to parse response data: %#v with error: %w\", string(data), err))\n\t\t}\n\t\tresponse = \"no\"\n\t\tif ok {\n\t\t\tresponse = \"yes\"\n\t\t}\n\t} else {\n\t\terr = json.Unmarshal(data, &response)\n\t\tif err != nil {\n\t\t\treturn fatal(fmt.Errorf(\"Failed to parse response data: %#v with error: %w\", string(data), err))\n\t\t}\n\t\tif is_fingerprint_check {\n\t\t\tresponse = strings.ToLower(response)\n\t\t\tswitch response {\n\t\t\tcase \"y\":\n\t\t\t\tresponse = \"yes\"\n\t\t\tcase \"n\":\n\t\t\t\tresponse = \"no\"\n\t\t\t}","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/askpass.go#L142-L178","documentation":"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.","triggerScenarios":"The parent writes a non-boolean JSON payload for a confirm request, or a truncated/corrupted SHM response.","commonSituations":"Version mismatch between askpass helper and kitty, or memory corruption from concurrent access to the SHM file.","solutions":["Match kitty and kitten helper versions","Ensure nothing else writes to the askpass-* SHM file","Retry; if reproducible, capture the printed %#v payload and report it"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if !json.Valid(data) { /* abort */ }\nvar ok bool\nif json.Unmarshal(data, &ok) != nil { /* reject before use */ }","typeGuard":"func isBoolJSON(b []byte) bool { var v bool; return json.Unmarshal(b, &v) == nil }","tryCatchPattern":null,"preventionTips":["Write strictly JSON booleans into the response region","Version-match both sides of the SHM protocol"],"tags":["json","parsing","shared-memory","ssh","askpass"],"backgroundTag":"invalid-json-input","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}