claude-code - 💡(How to fix) Fix Desktop app cannot import CLI session: 'transcript has no cwd' [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#48809Fetched 2026-04-16 06:50:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1

When attempting to open a CLI session transcript in the Claude Code desktop app, the import fails with:

CLI session <session-id> transcript has no cwd — cannot import

Root Cause

The transcript .jsonl file's first record is a file-history-snapshot type with no cwd field:

{
  "type": "file-history-snapshot",
  "messageId": "...",
  "snapshot": {
    "messageId": "...",
    "trackedFileBackups": {},
    "timestamp": "2026-04-14T20:54:58.699Z"
  },
  "isSnapshotUpdate": false
}

The cwd field does exist on attachment type records deeper in the file, but the desktop app appears to look for it in a metadata/init record at the start of the transcript and fails when it's not found.

Code Example

CLI session <session-id> transcript has no cwd — cannot import

---

{
  "type": "file-history-snapshot",
  "messageId": "...",
  "snapshot": {
    "messageId": "...",
    "trackedFileBackups": {},
    "timestamp": "2026-04-14T20:54:58.699Z"
  },
  "isSnapshotUpdate": false
}
RAW_BUFFERClick to expand / collapse

Description

When attempting to open a CLI session transcript in the Claude Code desktop app, the import fails with:

CLI session <session-id> transcript has no cwd — cannot import

Steps to Reproduce

  1. Run a Claude Code CLI session in a project directory
  2. Attempt to open/import that session in the Claude Code desktop app

Root Cause

The transcript .jsonl file's first record is a file-history-snapshot type with no cwd field:

{
  "type": "file-history-snapshot",
  "messageId": "...",
  "snapshot": {
    "messageId": "...",
    "trackedFileBackups": {},
    "timestamp": "2026-04-14T20:54:58.699Z"
  },
  "isSnapshotUpdate": false
}

The cwd field does exist on attachment type records deeper in the file, but the desktop app appears to look for it in a metadata/init record at the start of the transcript and fails when it's not found.

Expected Behavior

The desktop app should either:

  • Look for cwd in any record type (e.g., the first attachment record), or
  • Gracefully handle missing cwd by prompting the user to select a working directory

Environment

  • Claude Code CLI (latest)
  • Claude Code Desktop (macOS)
  • macOS Darwin 25.3.0

extent analysis

TL;DR

The desktop app fails to import CLI session transcripts due to missing cwd field in the initial record, suggesting a need to either modify the app to handle this case or adjust the transcript format.

Guidance

  • Verify that the cwd field is present in attachment type records within the transcript file, as expected, to confirm the issue lies in the app's handling of the initial record.
  • Consider modifying the desktop app to search for the cwd field in any record type, not just the first one, to improve flexibility.
  • As an alternative, the app could be updated to prompt the user for a working directory when the cwd field is missing, enhancing user experience.
  • Review the transcript generation process in the CLI to determine if it's possible to include the cwd field in the initial record or provide it through another means.

Example

No code snippet is provided as the issue seems to be related to the logic of handling transcript files rather than a specific code error.

Notes

The solution may depend on the specific requirements and constraints of the Claude Code desktop app and CLI, such as backward compatibility or security considerations. Adjustments to the app's logic or the transcript format may have implications for other features or user workflows.

Recommendation

Apply a workaround by modifying the desktop app to handle missing cwd fields more gracefully, such as by prompting the user to select a working directory, as this approach seems to balance usability with the constraints of the current transcript format.

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