{"record":{"id":"1540b03ea53d4f19","repo":"kovidgoyal/kitty","slug":"timed-out-waiting-for-a-response-from-the-terminal","errorCode":null,"errorMessage":"Timed out waiting for a response from the terminal: %w","messagePattern":"Timed out waiting for a response from the terminal: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/icat/detect.go","lineNumber":49,"sourceCode":"\t}\n\n\tdefer func() {\n\t\tif len(temp_files_to_delete) > 0 && transfer_by_file != supported {\n\t\t\tfor _, name := range temp_files_to_delete {\n\t\t\t\tos.Remove(name)\n\t\t\t}\n\t\t}\n\t\tif len(shm_files_to_delete) > 0 && transfer_by_memory != supported {\n\t\t\tfor _, name := range shm_files_to_delete {\n\t\t\t\t_ = name.Unlink()\n\t\t\t}\n\t\t}\n\t}()\n\n\tlp.OnInitialize = func() (string, error) {\n\t\tvar iid uint32\n\t\t_, _ = lp.AddTimer(timeout, false, func(loop.IdType) error {\n\t\t\treturn fmt.Errorf(\"Timed out waiting for a response from the terminal: %w\", os.ErrDeadlineExceeded)\n\t\t})\n\n\t\tg := func(t graphics.GRT_t, payload string) uint32 {\n\t\t\tiid += 1\n\t\t\tg1 := &graphics.GraphicsCommand{}\n\t\t\tg1.SetTransmission(t).SetAction(graphics.GRT_action_query).SetImageId(iid).SetDataWidth(1).SetDataHeight(1).SetFormat(\n\t\t\t\tgraphics.GRT_format_rgb).SetDataSize(uint64(len(payload)))\n\t\t\t_ = g1.WriteWithPayloadToLoop(lp, utils.UnsafeStringToBytes(payload))\n\t\t\treturn iid\n\t\t}\n\n\t\tdirect_query_id = g(graphics.GRT_transmission_direct, \"123\")\n\t\ttf, err := images.CreateTempInRAM()\n\t\tif err == nil {\n\t\t\tfile_query_id = g(graphics.GRT_transmission_tempfile, tf.Name())\n\t\t\ttemp_files_to_delete = append(temp_files_to_delete, tf.Name())\n\t\t\tif _, err = tf.Write([]byte{1, 2, 3}); err != nil {\n\t\t\t\tprint_error(\"Failed to write to temporary file for data transfer, file based transfer is disabled. Error: %v\", err)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/icat/detect.go#L31-L67","documentation":"icat sends a graphics query to the terminal and arms a one-shot timer on the event loop; if the terminal never responds within the timeout, the timer returns this error wrapping os.ErrDeadlineExceeded.","triggerScenarios":"Running icat against a terminal that doesn't support the kitty graphics protocol (so no query response), or a slow/overloaded terminal that misses the timeout window.","commonSituations":"Running kitty +kitten icat inside tmux/screen without proper passthrough, over ssh with a non-kitty terminal, or inside a plain Linux VT.","solutions":["Run inside a terminal supporting the kitty graphics protocol (kitty itself, or a compatible terminal)","Detach from tmux/screen or configure passthrough so escape sequences reach the outer terminal","Increase the timeout if the terminal is slow, or pre-check protocol support"],"exampleFix":"# before\n$ tmux\n$ kitty +kitten icat img.png\n# after: run directly in kitty, or set passthrough\n$ kitty +kitten icat img.png","handlingStrategy":"retry","validationCode":"if !supportsGraphicsProtocol() { /* skip query, render without graphics */ }","typeGuard":null,"tryCatchPattern":"On os.ErrDeadlineExceeded from the query, fall back to plain text output or retry once with a longer timeout.","preventionTips":["Check TERM/kitty env before sending graphics queries","Don't run icat through tmux/screen without passthrough"],"tags":["kitty","icat","graphics-protocol","timeout"],"backgroundTag":"terminal-response-timeout","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}