{"record":{"id":"3af9147b242ad978","repo":"kovidgoyal/kitty","slug":"unknown-osc-9-4-state-st","errorCode":null,"errorMessage":"Unknown OSC 9;4 state: {st}","messagePattern":"Unknown OSC 9;4 state: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/progress.py","lineNumber":45,"sourceCode":"        self.last_update_at = monotonic()\n        if st == 0:\n            self.state = ProgressState.unset\n            self.percent = 0\n        elif st == 1:\n            self.state = ProgressState.set\n            self.percent = max(0, min(percent, 100))\n        elif st == 2:\n            self.state = ProgressState.error\n            self.percent = 0\n        elif st == 3:\n            self.state = ProgressState.indeterminate\n            self.percent = 0\n        elif st == 4:\n            self.state = ProgressState.paused\n            if percent > -1:\n                self.percent = max(0, min(percent, 100))\n        else:\n            log_error(f'Unknown OSC 9;4 state: {st}')\n\n    def clear_progress(self) -> bool:\n        time_since_last_update = monotonic() - self.last_update_at\n        threshold = self.finished_clear_timeout if self.percent == 100 and self.state is ProgressState.set else self.clear_timeout\n        if time_since_last_update >= threshold:\n            self.state = ProgressState.unset\n            self.percent = 0\n            return True\n        return False\n","sourceCodeStart":27,"sourceCodeEnd":55,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/progress.py#L27-L55","documentation":"The terminal sent an OSC 9;4 progress sequence with a state number kitty does not recognize (only 0,1,2,3,4 are valid: remove, set, error, indeterminate, paused). kitty logs the unknown state and ignores the update.","triggerScenarios":"A shell script/program emitting printf '\\e]9;4;<state>,<percent>\\a' with state outside 0-4, hitting ProgressState update in kitty/progress.py.","commonSituations":"Hand-rolled progress-bar scripts or a terminal library that emits a non-standard/in newer OSC 9;4 state value.","solutions":["Check the emitted state number and use only 0,1,2,3,4","Update the library/script emitting the sequence to the documented OSC 9;4 spec","Ignore: harmless, kitty keeps the last valid progress state"],"exampleFix":"# before\nprintf '\\e]9;4;6,50\\a'\n\n# after\nprintf '\\e]9;4;1,50\\a'","handlingStrategy":"validation","validationCode":"def valid_osc94(state, pct):\n    return state in (0, 1, 2, 3, 4) and (pct == -1 or 0 <= pct <= 100)\n# only emit when valid\nif valid_osc94(s, p):\n    printf_osc(f'9;4;{s},{p}')","typeGuard":"is_valid_progress_state = lambda st: isinstance(st, int) and 0 <= st <= 4","tryCatchPattern":null,"preventionTips":["Only emit OSC 9;4 states 0-4","Use libraries like progress or kitty's shell integration instead of raw escapes"],"tags":["kitty","osc52-osc-sequences","progress","terminal-escape"],"backgroundTag":"unsupported-escape-sequence","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}