claude-code - 💡(How to fix) Fix --name flag sets session metadata but doesn't display name in TUI header [3 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#46478Fetched 2026-04-11 06:19:14
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4commented ×3

When starting a session with claude --name "My Session", the name is stored in the session JSON metadata (and works for --resume), but it does not display in the TUI header/prompt area.

In contrast, using /rename My Session during an interactive session both updates the metadata and displays the name in the TUI header.

Root Cause

When starting a session with claude --name "My Session", the name is stored in the session JSON metadata (and works for --resume), but it does not display in the TUI header/prompt area.

In contrast, using /rename My Session during an interactive session both updates the metadata and displays the name in the TUI header.

Fix Action

Fix / Workaround

A SessionStart hook was also attempted as a workaround but performed worse — it didn't even set the metadata for resume purposes.

RAW_BUFFERClick to expand / collapse

Description

When starting a session with claude --name "My Session", the name is stored in the session JSON metadata (and works for --resume), but it does not display in the TUI header/prompt area.

In contrast, using /rename My Session during an interactive session both updates the metadata and displays the name in the TUI header.

Steps to Reproduce

  1. Start a session: claude --name "Test Name"
  2. Observe: no session name visible in the TUI header near the input area
  3. During the session, run /rename Test Name
  4. Observe: the name now appears in the TUI header

Expected Behavior

--name should display the session name in the TUI header the same way /rename does. Both set the same name field in ~/.claude/sessions/<pid>.json — the visual display should be consistent.

Actual Behavior

  • --name: metadata only (resume works, no visual display)
  • /rename: metadata + visual display

Additional Context

A SessionStart hook was also attempted as a workaround but performed worse — it didn't even set the metadata for resume purposes.

Environment

  • Claude Code CLI
  • macOS

extent analysis

TL;DR

The issue can likely be resolved by updating the code to refresh the TUI header after setting the session name with the --name flag.

Guidance

  • Investigate the difference in how the /rename command and the --name flag update the session metadata and TUI header.
  • Check if the TUI header is updated dynamically when the session metadata changes, and if not, consider adding a refresh mechanism.
  • Review the SessionStart hook implementation to understand why it didn't work as expected, and consider revising it to update both the metadata and the TUI header.
  • Verify that the --name flag is correctly setting the name field in the session JSON metadata, and that the issue is solely with displaying the name in the TUI header.

Example

No code snippet is provided due to lack of specific implementation details.

Notes

The solution may depend on the internal implementation of the Claude Code CLI and its handling of session metadata and TUI updates.

Recommendation

Apply a workaround to refresh the TUI header after setting the session name with the --name flag, as this is likely the root cause of 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 --name flag sets session metadata but doesn't display name in TUI header [3 comments, 2 participants]