claude-code - 💡(How to fix) Fix Kitty: malformed OSC 9 notification '4;0;' emitted on /exit [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55614Fetched 2026-05-03 04:48:52
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Every time Claude Code exits (via /exit or /quit), it sends a malformed OSC 9 (ConEmu-style) notification to the terminal. In Kitty, this renders as a desktop notification with the body 4;0;.

Root Cause

Captured via Python pty, the exact byte sequence emitted at exit is:

\e]9;4;0;\a

This is an OSC 9 notification where the payload appears to be structured as <type>;<code>;<message> — but the <message> field is empty. Kitty has no message to display, so it renders the raw parameters (4;0;) as the notification body.

Fix Action

Workaround

None available on the Kitty side — Kitty 0.32.2 does not expose per-protocol notification suppression. Fix needs to be in Claude Code's exit/cleanup sequence.

Code Example

\e]9;4;0;\a

---

000004e0: 5b72 1b38 1b5d 393b 343b 303b 071b 5d30  [r.8.]9;4;0;..]0
000004f0: 3b07                                     ;.
RAW_BUFFERClick to expand / collapse

Description

Every time Claude Code exits (via /exit or /quit), it sends a malformed OSC 9 (ConEmu-style) notification to the terminal. In Kitty, this renders as a desktop notification with the body 4;0;.

Root Cause

Captured via Python pty, the exact byte sequence emitted at exit is:

\e]9;4;0;\a

This is an OSC 9 notification where the payload appears to be structured as <type>;<code>;<message> — but the <message> field is empty. Kitty has no message to display, so it renders the raw parameters (4;0;) as the notification body.

Steps to Reproduce

  1. Run claude in Kitty terminal (v0.32.2, Linux)
  2. Type /exit or /quit
  3. A Kitty desktop notification appears immediately with body 4;0;

This happens on every exit.

Environment

  • Claude Code: v2.1.126
  • Terminal: Kitty 0.32.2
  • OS: Ubuntu (Linux 6.17.0)
  • TERM: xterm-kitty
  • KITTY_WINDOW_ID is set (Claude Code detects Kitty)

Captured Evidence

Python pty capture (hex), offset 0x4e0 — the exit sequence:

000004e0: 5b72 1b38 1b5d 393b 343b 303b 071b 5d30  [r.8.]9;4;0;..]0
000004f0: 3b07                                     ;.

Decoded: \e[r (reset scroll region), \e8 (restore cursor), \e]9;4;0;\a (malformed notification), \e]0;\a (clear window title).

Expected Behavior

Either:

  • The notification body should contain a meaningful message (e.g. "Session ended"), or
  • The OSC 9 notification should not be emitted on exit at all

Workaround

None available on the Kitty side — Kitty 0.32.2 does not expose per-protocol notification suppression. Fix needs to be in Claude Code's exit/cleanup sequence.

extent analysis

TL;DR

Modify Claude Code's exit sequence to either omit the OSC 9 notification or provide a meaningful message in the notification payload.

Guidance

  • Investigate Claude Code's exit handling to identify where the OSC 9 notification is generated and modify it to include a meaningful message or remove it altogether.
  • Verify that the modified exit sequence no longer produces the malformed notification by capturing the output with a tool like Python pty.
  • Consider adding a configuration option to Claude Code to allow users to disable OSC 9 notifications on exit, if this behavior is not desired.
  • Review the Kitty documentation to see if there are any plans to add per-protocol notification suppression in future versions, which could provide an alternative workaround.

Example

No code example is provided as the issue does not specify the programming language or code structure of Claude Code.

Notes

The fix needs to be applied to Claude Code, as Kitty does not currently provide a way to suppress notifications on a per-protocol basis.

Recommendation

Apply workaround: Modify Claude Code's exit sequence to fix the malformed OSC 9 notification, as this is the most direct way to resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Kitty: malformed OSC 9 notification '4;0;' emitted on /exit [1 comments, 2 participants]