Session not found error when opening previous conversations in Cursor (exit code 1)

Resolved 💬 3 comments Opened Feb 3, 2026 by alejopijuan Closed Feb 3, 2026

Environment

  • Claude Code extension version: 2.1.27
  • Editor: Cursor 2.4.27 (arm64)
  • OS: macOS 26.3 (Build 25D5112c)

Description

When attempting to open or resume previous conversations in the Claude Code VSCode/Cursor extension, the process fails with "session not found" followed by exit code 1. New conversations work fine — this only affects past conversations.

Additionally, the sessions-index.json was out of sync with session files on disk (1 entry indexed vs 6 .jsonl files present), which may be related.

Steps to Reproduce

  1. Have existing Claude Code conversations in a project
  2. Close Cursor
  3. Reopen Cursor and attempt to resume/access a previous conversation
  4. Error: "session not found", then process exits with code 1

Logs

MCP connection errors (observed during session)

2026-02-02 21:43:29.721 [info] From claude: 2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": STDIO connection dropped after 0s uptime
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": Connection error: JSON Parse error: Single quotes (') are not allowed in JSON
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": STDIO connection dropped after 0s uptime
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": Connection error: JSON Parse error: Single quotes (') are not allowed in JSON
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": STDIO connection dropped after 0s uptime
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": Connection error: JSON Parse error: Single quotes (') are not allowed in JSON
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": STDIO connection dropped after 0s uptime
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": Connection error: JSON Parse error: Single quotes (') are not allowed in JSON
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": STDIO connection dropped after 0s uptime
2026-02-02T21:43:29.721Z [DEBUG] MCP server "n8n-docs": Connection error: JSON Parse error: Single quotes (') are not allowed in JSON

API error when resuming session

When attempting to resume the old session, the API returned:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.0.content.0: unexpected `tool_use_id` found in `tool_result` blocks: toolu_01Dn5apfNApg3hjRcUzY1j3o. Each `tool_result` block must have a corresponding `tool_use` block in the previous message."},"request_id":"req_011CXjz2bHCHgMCUUckAcqrn"}

This suggests the session replay/reconstruction has orphaned tool_result blocks without matching tool_use blocks, causing the API to reject the conversation history.

Observations

  1. sessions-index.json out of sync: Only 1 of 6 session .jsonl files was listed in the index. Manually rebuilding the index did not fix the resume error.
  2. MCP crash loop: A misconfigured MCP server (n8n-docs) was crash-looping with JSON parse errors. Even after disabling all MCPs and clearing MCP config, the session resume issue persisted.
  3. Orphaned tool_result blocks: The root cause appears to be corrupted session history where tool_result blocks lost their corresponding tool_use blocks, making the conversation impossible to replay via the API.

What I've Tried

  • Removing Cursor settings
  • Disabling all MCP servers (backed up and emptied ~/.claude/mcp.json)
  • Removing session history / clearing session data
  • Rebuilding sessions-index.json to include all session files on disk
  • None of these resolved the "session not found" error for past conversations

Expected Behavior

Previous conversations should be accessible and resumable. If session data becomes corrupted (e.g., orphaned tool_result blocks), Claude Code should handle it gracefully — either by repairing the conversation history or showing a clear error rather than crashing with exit code 1.

Suggested Improvements

  1. Session repair: Automatically strip orphaned tool_result / tool_use blocks before replaying history
  2. Graceful degradation: Show a "this session cannot be resumed" message instead of crashing
  3. Index sync: Keep sessions-index.json in sync with session files on disk
  4. MCP isolation: Prevent MCP server failures from causing Claude Code to exit

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗