[BUG] --teleport fails with "Session not found" despite valid session (claude.ai returns 403 to CLI)

Status Fixed / completed
Reported on v2.1.37
Maintainer reply None cached
Activity 10 comments · opened Feb 8, 2026 · closed Feb 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

claude --teleport session_xxx always fails with "Session not found" even though the session is active and accessible on claude.ai/code.

The root cause appears to be that claude.ai API endpoints return HTTP 403 to non-browser HTTP clients, while api.anthropic.com endpoints work correctly with the same OAuth token.

Evidence:
curl -H "Authorization: Bearer $TOKEN" "https://api.anthropic.com/v1/session_ingress/session/session_xxx" → Returns full session data with loglines ✅
curl -H "Authorization: Bearer $TOKEN" "https://claude.ai/api/code/sessions" → HTTP 403 ❌

Same claude.ai URL in browser → Returns JSON normally ✅

claude --teleport (without ID, to list sessions) → "Error loading Claude Code sessions" ❌

The CLI appears to validate/fetch sessions via claude.ai endpoints (which get 403'd) rather than api.anthropic.com (which works fine).

What Should Happen?

claude --teleport <session_id> should successfully connect to and resume the web session. The CLI should either use api.anthropic.com endpoints (which work), or handle claude.ai 403 responses gracefully with a meaningful error message.

Error Messages/Logs

2026-02-08T05:29:48.335Z [DEBUG] Resuming code session ID: session_xxx
2026-02-08T05:29:48.623Z [ERROR] Error: Error: Session not found: session_xxx
    at pxT (/$bunfs/root/claude:1931:39772)
    at async ds (/$bunfs/root/claude:2879:1875)
    at async Oy8 (/$bunfs/root/claude:6381:552)
    at async E40 (/$bunfs/root/claude:6364:813)
    at processTicksAndRejections (native:7:39)
2026-02-08T05:29:48.624Z [ERROR] TeleportOperationError: TeleportOperationError: Session not found: session_xxx

No HTTP request URL is logged between "Resuming code session ID" and the error — the fetch appears to fail silently.

Steps to Reproduce

  1. Start a Claude Code session on claude.ai/code (web interface)
  2. Copy the session ID from the URL (format: session_01Mhb...)
  3. In terminal, run claude --teleport session_01Mhb...
  4. Error: "Session not found"
  5. Verify the session is accessible via API: curl -H "Authorization: Bearer $(security find-generic-password -s 'Claude Code-credentials' -w | python3 -c "import sys,json; print(json.load(sys.stdin)['claudeAiOauth']['accessToken'])")" "https://api.anthropic.com/v1/session_ingress/session/<SESSION_ID>" — returns full session data
  6. Verify claude.ai is 403'd: curl -v -H "Authorization: Bearer $TOKEN" "https://claude.ai/api/code/sessions" — returns HTTP 403

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.37 (also tested 2.1.17 and 2.1.0 — same error)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Tested across multiple Claude Code versions (2.1.0, 2.1.17, 2.1.37)
  • Tried re-authentication (claude logout → claude login) multiple times
  • Tried switching DNS to Google (8.8.8.8) — no change
  • Tried checking out the matching git branch — no change
  • Location: Australia (Sydney) — possibly relevant to Cloudflare geo-blocking

View original on GitHub ↗

10 Comments

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/16820
  2. https://github.com/anthropics/claude-code/issues/16403
  3. https://github.com/anthropics/claude-code/issues/16253

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

quangthien27 · 6 months ago

Opus tried to debug from the compiled claude
---
Root Cause Analysis

The --teleport feature works like this:

The API Flow

  1. OB() config (XA9() always returns "prod") resolves BASE_API_URL to https://api.anthropic.com - this is correct and hardcoded.
  2. pxT(sessionId) - fetches a single session:

GET ${BASE_API_URL}/v1/sessions/${sessionId}
// i.e. https://api.anthropic.com/v1/sessions/<id>

  1. Uses validateStatus: status < 500 (so 403/404 don't throw Axios errors), then checks:
  • 404 → throws "Session not found: <id>"
  • 401 → throws "Session expired..."
  • Other non-200 → throws generic error
  1. b5B() - lists all sessions:

GET ${BASE_API_URL}/v1/sessions
// i.e. https://api.anthropic.com/v1/sessions

  1. Uses tt7() (retry wrapper with backoff for 5xx/network errors).

The Bug

The CLI is using api.anthropic.com (not claude.ai), so the user's hypothesis about claude.ai endpoints being used is incorrect. However, the real issue is likely one of these:

  1. The API returns 404 (not 403) for this user's session at api.anthropic.com/v1/sessions/<id>, which maps to the "Session not found" error. The pxT function has

validateStatus: ($) => $ < 500, so a 403 would actually fall through to the generic error path (Failed to fetch session: 403 Forbidden), not the "Session not found"
path. The fact that the user sees "Session not found" means the API is returning exactly 404.

  1. Endpoint mismatch: The user's working curl uses /v1/session_ingress/session/<id> while the CLI's pxT uses /v1/sessions/<id>. These are different endpoints! The

session_ingress endpoint exists in the codebase too (for persisting session data), but it's not used for the teleport validation flow.

  1. Organization UUID mismatch: The pxT function sends x-organization-uuid header. If the org UUID doesn't match the org that owns the session, the API likely returns 404

Key Finding

The user proved that GET /v1/session_ingress/session/<id> works, but the teleport code uses GET /v1/sessions/<id> which returns 404. This could be:

  • A backend routing/authorization issue where the /v1/sessions/ endpoint requires different permissions or org context
  • The session was created under a different organization than what kk() (org UUID getter) returns
  • A geo-related issue (user is in Australia) where the /v1/sessions/ endpoint behaves differently

The claude.ai 403 is a red herring

The user also tested claude.ai/api/code/sessions which returns 403 - but the CLI never calls that endpoint. The CLI exclusively uses api.anthropic.com.

Recommendation

This is a server-side issue, not a client-side bug. The /v1/sessions/<id> endpoint returns 404 for sessions that are demonstrably accessible via /v1/session_ingress/session/<id>. Since this is the public open-source repo (docs/plugins/changelog only) and the actual CLI is a compiled binary, there's nothing to fix here. This should be escalated to the Anthropic backend team to investigate why the /v1/sessions/ endpoint returns 404 for valid sessions.

hbmartin · 6 months ago

Also having this issue

Krozark · 6 months ago

same with version 2.1.34 (Claude Code)

nightpool · 6 months ago

Also having this issue

Self-Perfection · 6 months ago

Also have this

installed @anthropic-ai/claude-code@2.1.39

jade-42 · 6 months ago

I am having this issue also.

swiftsource-dev · 6 months ago

Same currently on v2.1.39 but its been an issue for a few versions at least

quangthien27 · 6 months ago

Seems working again now with new 2.1.42 🥳

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.