{"record":{"id":"2e10163948e71c93","repo":"kovidgoyal/kitty","slug":"pending-mode-change-to-already-current-mode-d-r","errorCode":null,"errorMessage":"Pending mode change to already current mode (%d) requested. Either pending mode expired or there is an application bug.","messagePattern":"Pending mode change to already current mode \\((.+?)\\) requested\\. Either pending mode expired or there is an application bug\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"kitty/screen.c","lineNumber":2035,"sourceCode":"            if (val) {\n                // When DECCOLM mode is set, the screen is erased and the cursor\n                // moves to the home position.\n                screen_erase_in_display(self, 2, false);\n                screen_cursor_position(self, 1, 1);\n            }\n            break;\n        case CONTROL_CURSOR_BLINK: self->cursor->non_blinking = !val; break;\n        case SAVE_CURSOR: screen_save_cursor(self); break;\n        case TOGGLE_ALT_SCREEN_1:\n        case TOGGLE_ALT_SCREEN_2:\n        case ALTERNATE_SCREEN:\n            if (val && self->linebuf == self->main_linebuf) screen_toggle_screen_buffer(self, mode == ALTERNATE_SCREEN, mode == ALTERNATE_SCREEN);\n            else if (!val && self->linebuf != self->main_linebuf) screen_toggle_screen_buffer(self, mode == ALTERNATE_SCREEN, mode == ALTERNATE_SCREEN);\n            break;\n        case 7727 << 5: log_error(\"Application escape mode is not supported, the extended keyboard protocol should be used instead\"); break;\n        case PENDING_MODE << 5:\n            if (!screen_pause_rendering(self, val, 0)) {\n                log_error(\"Pending mode change to already current mode (%d) requested. Either pending mode expired or there is an application bug.\", val);\n            }\n            break;\n        case INBAND_RESIZE_NOTIFICATION:\n            self->modes.mINBAND_RESIZE_NOTIFICATION = val;\n            if (val) CALLBACK(\"notify_child_of_resize\", NULL);\n            break;\n        case VISIBILITY_REPORTS:\n            self->modes.mVISIBILITY_REPORTS = val;\n            if (val) send_visibility_report(self);\n            break;\n        default:\n            private = mode >= 1 << 5;\n            if (private) mode >>= 5;\n            log_error(\"%s %s %u %s\", ERROR_PREFIX, \"Unsupported screen mode: \", mode, private ? \"(private)\" : \"\");\n    }\n#undef SIMPLE_MODE\n#undef MOUSE_MODE\n}","sourceCodeStart":2017,"sourceCodeEnd":2053,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/screen.c#L2017-L2053","documentation":"An application toggled DEC private mode 2026 (pending/synchronized update mode) to the value already current - screen_pause_rendering returned false. Either the ~250ms pending window expired and the app re-issued the same change, or the app has a state bug. Rendering continues unsynchronized.","triggerScenarios":"Program using synchronized output sends a duplicate CSI ? 2026 h (begin-begin) or an l after the pending period already expired.","commonSituations":"Frame-synchronization bugs in TUI apps, or slow rendering causing kitty's pending timeout to expire before the app ends the frame.","solutions":["Usually harmless - rendering continues without synchronization","If you author the app, only send CSI ? 2026 l after a successful h","Keep frame output under ~250ms so pending mode does not expire","Update the app - duplicate-pending bugs get fixed over time"],"exampleFix":"# before\nprintf '\\033[?2026h'; printf '\\033[?2026h'  # duplicate begin\n# after\nprintf '\\033[?2026h'  # begin once\nprintf '\\033[?2026l'  # end once","handlingStrategy":"validation","validationCode":"# track pending-mode state in your renderer\nif not pending_active:\n    sys.stdout.write('\\033[?2026h'); pending_active = True\n# ... draw frame ...\nsys.stdout.write('\\033[?2026l'); pending_active = False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair 2026 h with exactly one 2026 l","Keep frame output under ~250ms so pending mode does not expire"],"tags":["kitty","pending-mode","synchronized-output","terminal-modes"],"backgroundTag":"invalid-terminal-mode-sequence","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}