claude-code - 💡(How to fix) Fix [BUG] "4;0;" notifications appearing on Claude code exit [1 comments, 1 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#46358Fetched 2026-04-11 06:22:24
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

Code Example



---

2. Press `^D` twice to exit.
3. Observe the notification.

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

2.1.100 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Other

### Additional Information

I ran `claude` using `script` to capture its output:

---

The last few characters it outputs (with control-characters converted to `<this-format>`) are:
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When I exit Claude code, I get a notification from my terminal (Kitty) that says "4;0;".

<img width="370" height="83" alt="Image" src="https://github.com/user-attachments/assets/9ef4c949-8e58-4126-b395-f12562a285ad" />

I am using kitty 0.33.1 on macOS.

This issue has been reported before, but both instance I found were closed due to inactivity. The instructions there say "If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant."

What Should Happen?

This notification should not appear.

Error Messages/Logs

Steps to Reproduce

  1. In kitty, start Claude Code:

    claude
  2. Press ^D twice to exit.

  3. Observe the notification.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.100 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

I ran claude using script to capture its output:

script -q /tmp/claude.out claude

The last few characters it outputs (with control-characters converted to <this-format>) are:

<Esc>]9;4;0;<Ctrl-G><Esc>]0;<Ctrl-G>

This appears to be a malformed OSC 9 sequence, which kitty is interpreting as a request to display the notification "4;0;<Ctrl-G>", followed by an OSC 0 to clear the terminal title.

extent analysis

TL;DR

The issue can likely be fixed by modifying Claude Code to output a properly formatted OSC 9 sequence or by configuring Kitty to ignore malformed sequences.

Guidance

  • Investigate the output of Claude Code to determine why it is producing a malformed OSC 9 sequence (<Esc>]9;4;0;<Ctrl-G><Esc>]0;<Ctrl-G>) and modify it to produce a valid sequence if possible.
  • Check Kitty's documentation to see if there is a configuration option to ignore or handle malformed OSC sequences, which could provide a workaround.
  • Review the previously closed issues (https://github.com/anthropics/claude-code/issues/21435 and https://github.com/anthropics/claude-code/issues/40188) for any relevant information or suggestions that may have been overlooked.
  • Consider capturing more output from Claude Code using script or another tool to see if there are any other relevant details that could help diagnose the issue.

Example

No specific code example can be provided without more information about the internals of Claude Code, but the general approach would involve examining the code that generates the OSC 9 sequence and ensuring it follows the correct format.

Notes

The exact fix may depend on the specifics of how Claude Code generates its output and how Kitty handles OSC sequences. Without more information about these internals, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Given that this is a regression and the previous version worked, it might be more feasible to apply a workaround, such as configuring Kitty to handle the malformed sequence, rather than waiting for a fix in Claude Code.

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 [BUG] "4;0;" notifications appearing on Claude code exit [1 comments, 1 participants]