Where did my Qwen Code session go? Finding and resuming a session
Qwen Code keeps each session in a folder named after the directory you launched it from: ~/.qwen/projects/<flattened-launch-directory>/chats/<session-id>.jsonl. The folder is keyed to that launch directory, and the filename is the full session ID, not an abbreviation. The file is JSONL (one JSON object per line): your prompts, the model's replies, each tool call and its result, plus records for the title, model, approval mode, compaction and file-history snapshots. Qwen Code appends while you work, so closing the terminal does not delete the conversation.
Most "my session is gone" cases are not deletions. Qwen Code is looking in another directory, recording was off, the file is damaged or too large to load, or the session was removed. This guide separates those cases.
Run qwen --version first. The paths and commands below describe v0.26.2 (27 October 2026).
Checked against Qwen Code's documentation and source on 27 October 2026.
Status, 27 October 2026: a transcript over 256 MiB cannot be opened by the daemon and Web Shell (Qwen's background server and browser UI) (#13113, open, updated 26 October 2026), and a very long project path can stop recording and break qwen sessions list (#15412, open, updated 25 October 2026).
Where Qwen Code saves a session#
Each session is one file in the current project's chats directory:
~/.qwen/projects/<flattened-launch-directory>/chats/<session-id>.jsonlThe project folder is the absolute directory where you launched qwen, flattened into one path component: every character that is not a letter or digit becomes a dash. Starting in /home/you/code/shop gives -home-you-code-shop; starting in packages/api inside it gives a different folder and a different list. The filename is the full session ID, not an abbreviation.
QWEN_HOME moves the whole .qwen directory. QWEN_RUNTIME_DIR moves runtime output, including sessions, without moving settings or credentials. If one terminal or container sets either variable and another does not, they see different session libraries:
echo "$QWEN_HOME"
echo "$QWEN_RUNTIME_DIR"One setting can prevent a session from existing: the settings reference documents general.chatRecording, and --chat-recording false does the same for one run. Either stops history being written, after which --continue and --resume cannot work.
No documented setting expires session transcripts. general.cleanupPeriodDays prunes ~/.qwen/file-history/ backups and debug logs, not the chats/ transcripts. A transcript stays until you delete it or storage fails.
The commands, and the two meanings of "continue"#
| What you want | Command |
|---|---|
| Continue the most recent session in this directory | qwen --continue (or qwen -c) |
| Pick from this directory's sessions | qwen --resume (or qwen -r) |
| Open a known session | qwen --resume <session-id-or-title> |
| Open a copy and leave the original alone | qwen --resume <session-id> --fork-session |
| Pick from inside a running session | /resume |
| List from the shell | qwen sessions list |
| List as JSON, with paths | qwen sessions list --json --limit 50 |
The trap is the word "continue". At the shell, qwen --continue resumes the newest session for this project immediately, and starts a new one silently if it finds none. Inside a session, /continue is an alias for /resume and opens the picker. If you expected the newest conversation and got a list, that is why.
qwen --resume without an ID opens the picker, which shows each session's summary or first prompt, when it ran, message count and git branch. A custom title works too: set one with /rename, then use qwen --resume "checkout refactor" or /resume checkout refactor.
qwen sessions ps is a different list: live-process records, not saved transcripts. A record can outlive its process, and a one-shot qwen -p run does not register.
Why the session is not in the list#
You launched from another directory. The key is the exact working directory, not the git root. A subdirectory, a moved or renamed folder, or a separate git worktree all produce another project folder. cd back and run qwen --resume. To see recorded paths:
qwen sessions list --json --limit 50 \
| jq -r '[.sessionId, .cwd, .filePath] | @tsv'You are in another Qwen home. Check QWEN_HOME and QWEN_RUNTIME_DIR in the shell that starts Qwen Code, including containers, another user, or the other side of WSL.
Recording was off. No transcript exists with general.chatRecording: false or --chat-recording false. Turn it back on and restart.
/clear or the welcome-back prompt started a new session. /clear, /reset and /new rotate to a new session ID but leave the old transcript resumable. A separate open report describes the welcome-back "continue" path creating a new session seeded with @.qwen/PROJECT_SUMMARY.md instead of reopening the old one — new ID, injected prompt, one reply (#3152, open, updated 11 April 2026). If that happened, pick the original in /resume.
The path was too long, or you deleted it. Qwen flattens the whole absolute path into one folder name. If that exceeds the filesystem's per-component limit, the transcript is never created, a headless run can still report success and print an ID, and sessions list fails with ENAMETOOLONG (#15412, open, updated 25 October 2026). Deletion is covered below; closing the terminal and /clear are not deletion.
Find a session by what you remember#
The transcripts are plain files, so you can search them without the picker:
grep -rl "stripe webhook" ~/.qwen/projects/*/chats/*.jsonl
head -n 1 ~/.qwen/projects/*/chats/<session-id>.jsonl \
| jq '{sessionId, cwd, timestamp, gitBranch}'Then cd to that cwd and run qwen --resume <session-id>. This works even when the picker is slow or the session is filtered out.
Listed but won't open#
The picker reads ten lines; the loader reads the file. The picker scans only the first ten lines of each JSONL to find a title and first prompt. Resuming rebuilds the conversation chain from the entire file, so the list is a preview and the load is the proof. In April 2026 a malformed record in the transcript produced exactly that split: the session stayed in the picker and the load failed with No saved session found with ID <session-id>. (#3606). The parser was made tolerant and the reporter recovered the session; the issue closed as completed on 27 April 2026. A session can still resume with a history gap when records beyond the preview are missing, so check the conversation after it opens.
If it happens, copy the file before touching it:
mkdir -p ~/qwen-session-backup
cp -a ~/.qwen/projects/<project>/chats/<session-id>.jsonl ~/qwen-session-backup/A crash usually leaves the final line incomplete; jq -c. on the copy stops at the first parse error and reports the line. Removing only an incomplete final line from the copy is the usual repair. Do not edit the original while a Qwen process may still be writing.
A session that only recorded startup has no reconstructable chain and nothing to resume. That is an empty session, not lost work.
The file belongs to another project folder. Because the folder name is a flattened path, /home/you/code/api-v2 and /home/you/code/api/v2 both become -home-you-code-api-v2 and share one chats/ directory. Qwen filters the list by hashing the cwd in each file, so a file you can see with ls may not appear here. Read its first record and go to that cwd.
Another process has it open. In the daemon (Qwen's background server, qwen serve) and Web Shell (its browser UI), opening a conversation takes a writer lease. session_writer_conflict means a live or stalled writer holds it; session_writer_unavailable means ownership could not be verified, and retrying is not a bypass. Close it in the owning Qwen process, then retry. For a residual lock after a crash, follow the conversation recovery guide rather than deleting lock files.
The transcript is over 256 MiB. The daemon and Web Shell index a transcript before serving it, and the index limit is hard-coded at 256 MiB in v0.26.2. A larger session fails with Transcript snapshot for session <id> is too large to index (#13113, open, updated 26 October 2026). The report's example was 332 MB, mostly file-history snapshots (211 MB) and UI telemetry (99 MB), with about 20 MB of conversation. The CLI's own loader has no 256 MiB check, but a file that size is still slow. Open it from the CLI if you can and /export jsonl before cleanup. If both refuse, the transcript is still readable text; keep the original until any salvage is verified.
After it opens, check that it is the right session#
- The conversation. Match the picker's start time, message count, first prompt and branch.
qwen sessions list --jsonshows the start time, prompt, branch, path andcwd. - The working tree. Run
git status,git log -1andgit diff --stat. The transcript carries the old plan; the files carry the current branch. - The context.
/context detailshows what fills the window, including theMemory filesrows for the instruction files that loaded./memoryopens the auto-memory panel; it is not the load list. In the CLI, a resume starts a new process and loads the instruction files from disk, so edits toQWEN.mdorAGENTS.mdmade since then apply now; the instruction-loading guide explains the order.
If the session was compacted, the model may work from a summary even though the file still holds the earlier records. Context compaction explains what the summary keeps, and why a compressed turn cannot be rewound.
Back it up, export it, or move it#
With Qwen Code closed, copy the transcript and, if you use /rewind, its file-history backups:
mkdir -p ~/qwen-session-backup
cp -a ~/.qwen/projects/<project>/chats ~/qwen-session-backup/
cp -a ~/.qwen/file-history/<session-id> ~/qwen-session-backup/ 2>/dev/null || trueTranscripts are plaintext and can contain source code, tool output and secrets. Treat the backup like the machine.
For a portable copy, /export md writes Markdown and /export jsonl writes the records; both are self-contained. /export html loads its renderer from unpkg for the exact Qwen Code version, so it needs a network connection and a published version.
On the same machine, qwen --resume <session-id> --fork-session opens a copy under a new ID and leaves the original untouched.
Moving a transcript to another folder is not a supported import at v0.26.2. The loader checks the cwd recorded in the file against the directory you launch from, and there is no --session-file flag. Copying the JSONL into another project's chats directory does not make it that project's session. If the absolute path is identical on the other machine, copying chats/ works; otherwise export and start a new session, or write a short handoff note. The handoff guide has the shape.
What `/delete` removes#
/delete opens a picker of previous sessions and refuses to delete the current active one. On current builds it removes the transcript, worktree and PR sidecars, the prompt ledger, and file-history backups. It also purges that session's prompts from the project-shared logs.json behind the up-arrow prompt history; that part was added in September 2026, so older builds left them behind (#11762, closed as completed 18 September 2026). There is no trash.
Close any other Qwen process that has the session open first. Deleting a session a daemon or Web Shell still has attached can let the surviving writer recreate a head-less transcript that keeps growing and is classified as degraded history (#12091, open, updated 2 October 2026). If you might want the conversation, run /export md first.
/clear is not delete: it starts a new session and leaves the old transcript resumable. Neither is closing the terminal. The delete guide covers the destructive commands across agents.
Where to go next#
- Qwen Code guides — the hub for this set.
- Back up coding-agent sessions — what to copy before an upgrade.
- Clear or delete coding-agent session history — what each destructive command leaves behind.
- What Qwen Code loads: QWEN.md and AGENTS.md — if the resumed session is missing its rules.
- Context compaction — if the session resumed but the middle of the work is gone.
- Where did my Gemini CLI session go? — the same job in the tool Qwen Code forked from, where the filename is only a prefix of the session ID and retention deletes sessions after 30 days.