{"record":{"id":"886c026407157a29","repo":"kovidgoyal/kitty","slug":"timed-out-waiting-for-response-from-terminal","errorCode":null,"errorMessage":"timed out waiting for response from terminal","messagePattern":"timed out waiting for response from terminal","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/query_terminal/main.go","lineNumber":75,"sourceCode":"\t\t\tlp.Quit(0)\n\t\t}\n\t\treturn nil\n\t}\n\terr = lp.Run()\n\trc = lp.ExitCode()\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\tds := lp.DeathSignalName()\n\tif ds != \"\" {\n\t\tfmt.Println(\"Killed by signal: \", ds)\n\t\tlp.KillIfSignalled()\n\t\treturn\n\t}\n\tos.Stdout.WriteString(buf.String())\n\n\tif timed_out {\n\t\treturn 1, fmt.Errorf(\"timed out waiting for response from terminal\")\n\t}\n\treturn\n}\n\nfunc EntryPoint(parent *cli.Command) {\n\tcreate_cmd(parent, main)\n}\n","sourceCodeStart":57,"sourceCodeEnd":83,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/query_terminal/main.go#L57-L83","documentation":"query_terminal kitten sent an escape-sequence query to the terminal and did not receive a response before the timeout expired. It is thrown by main() after the read loop finishes with timed_out set, meaning the terminal never answered the query (or the answer arrived too late). Exit code 1 is returned after the partial buffer was already written to stdout.","triggerScenarios":"Running the query_terminal kitten against a terminal emulator that does not implement the queried escape sequence (e.g. color scheme or clipboard queries), piping/redirecting output where no real terminal responds, or a very slow/locked terminal exceeding the timeout.","commonSituations":"Running kitty kittens over SSH without proper TERM=kitty, inside tmux/screen which swallow unknown queries, in CI, or against a non-kitty terminal that ignores the query.","solutions":["Run inside kitty (or a terminal that implements the queried escape sequence) and verify TERM=xterm-kitty","Increase the query timeout if the kitten exposes a flag for it","Avoid running query_terminal when stdout is not a TTY; detect with os.Stdout.Stat() and ModeCharDevice","If under tmux/screen, set passthrough or run the query directly in kitty"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if fi, _ := os.Stdout.Stat(); fi != nil && fi.Mode()&os.ModeCharDevice == 0 { return errors.New(\"not a terminal\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check TERM is set to a kitty-compatible value before querying","Skip escape-sequence queries when stdout is piped","Use a generous timeout for slow terminals"],"tags":["terminal","escape-sequences","timeout","kitty"],"backgroundTag":"terminal-query-timeout","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}