{"record":{"id":"3760f9aa9b9377f4","repo":"kovidgoyal/kitty","slug":"invalid-response-received-from-kitty-unmarshallin","errorCode":null,"errorMessage":"Invalid response received from kitty, unmarshalling error: %w","messagePattern":"Invalid response received from kitty, unmarshalling error: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/cmd/at/main.go","lineNumber":250,"sourceCode":"\t\t\tio_data.chunks_done = false\n\t\t\t_, _ = do_io(io_data)\n\t\t\terr = fmt.Errorf(\"Timed out waiting for a response from kitty\")\n\t\t}\n\t\treturn nil, err\n\t}\n\tif len(serialized_response) == 0 {\n\t\tif io_data.rc.NoResponse {\n\t\t\tres := Response{Ok: true}\n\t\t\tans = &res\n\t\t\treturn\n\t\t}\n\t\terr = fmt.Errorf(\"Received empty response from kitty\")\n\t\treturn\n\t}\n\tvar response Response\n\terr = json.Unmarshal(serialized_response, &response)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Invalid response received from kitty, unmarshalling error: %w\", err)\n\t\treturn\n\t}\n\tans = &response\n\treturn\n}\n\nvar running_shell = false\n\ntype exit_error struct {\n\texit_code int\n}\n\nfunc (m *exit_error) Error() string {\n\treturn fmt.Sprintf(\"Subprocess exit with code: %d\", m.exit_code)\n}\n\nfunc send_rc_command(io_data *rc_io_data) (err error) {\n\terr = setup_global_options(io_data.cmd)","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/cmd/at/main.go#L232-L268","documentation":"kitty @ got a non-empty response but it is not valid JSON — json.Unmarshal of the Response struct failed. The remote control channel always exchanges JSON, so this indicates a corrupted or foreign stream.","triggerScenarios":"Any garbage bytes arriving on the RC socket where JSON is expected: interleaved output, partial writes, or a different program's data on the socket.","commonSituations":"Kitty version mismatch changing the wire format, ssh forwarding corruption, the socket path pointing at a stale/other kitty instance, or custom listeners on the same socket.","solutions":["Ensure the kitty @ binary and the running kitty are the same version","Check KITTY_SOCKET / --to points at the intended kitty instance","Restart kitty to recreate a clean socket","If forwarding over ssh, verify the forwarding setup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if !json.Valid(serialized) { /* protocol corruption; restart session */ }","typeGuard":"func isJSONResponse(b []byte) bool { return json.Valid(b) }","tryCatchPattern":"if err := json.Unmarshal(data, &resp); err != nil { /* re-establish connection to the socket and retry */ }","preventionTips":["Use matching kitty versions on both ends of the socket","Don't share the RC socket with other programs"],"tags":["kitty","remote-control","json","parsing"],"backgroundTag":"invalid-json-response","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}