[BUG] Status line JSON contains literal newlines in session_name, breaking jq parsing
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When a session originates from a slash command (e.g. /brainstorm), the session_name field in the status line JSON input contains literal (unescaped) newlines. This produces invalid JSON that causes jq and other strict JSON parsers to fail silently, resulting in the status line not rendering any data derived from the JSON.
What Should Happen?
The session_name field should properly escape newlines as \n per the JSON specification, so that the status line input is always valid JSON.
Error Messages/Logs
Example of invalid JSON received by the status line command:
"session_name":"<command-message>brainstorm</command-message>
<command-name>/brainstorm</command-name>
<command-args (Fork 7)"
The literal newlines inside the string value make the JSON unparseable.
Steps to Reproduce
- Configure a custom status line in
settings.jsonthat parses stdin withjq - Start a conversation using a slash command (e.g.
/brainstorm) - Fork the conversation with
/fork - The status line fails to render any JSON-derived data (e.g. context bar)
- Resuming the original session also exhibits the same broken behavior
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.55 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Terminal: WezTerm
Workaround: pipe stdin through tr '\n' ' ' before jq to collapse literal newlines.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗