[BUG] CC 2.1.1 Remote/Background Sessions Failing Intermittently
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?
Background sessions (& command) fail with multiple different errors even after proper setup. The session may appear to start on the web interface but doesn't execute properly.
What Should Happen?
- After installing GitHub app, background sessions should work immediately from CLI
- After successful /login, background sessions should work consistently
Error Messages/Logs
Steps to Reproduce
- Install Claude GitHub app on the repository
- Run a background task: & test
- Receive error:
Cannot launch remote Claude Code session.
The Claude GitHub app must be installed on this repository first.
https://github.com/apps/claude/installations/new
- Note: This error appears even though the GitHub app IS already installed.
- The only way to proceed is to first execute ANY action from the Claude Code web interface on this repository.
- After that, retry: & test
- Receive new error: Failed to create background session: Failed to create remote session
- Run /login - login succeeds
- Try another background task
- Receive yet another error: Failed to create background session: Failed to upload session history (message 1/12)
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.1
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Actual Behavior
- Initial block: "GitHub app must be installed" error appears despite app being installed
- Workaround required: Must first use web interface on the repo to "initialize" something
- After workaround: Still fails with "Failed to create remote session"
- After /login: Fails with different error "Failed to upload session history"
- Web UI behavior: Shows "Starting Claude Code..." but agent doesn't actually execute
Root Cause Hypothesis
There appears to be a missing initialization/registration step that only gets triggered when using the web client first. The CLI alone cannot properly initialize a repository for remote sessions, even with all prerequisites met.
Workaround
Execute any action from Claude Code web interface first on the target repository before attempting to use & background commands from CLI.
Additional Notes
- Login state doesn't persist between background session attempts
- Three distinct failure modes observed in sequence:
a. GitHub app not detected (false positive)
b. Remote session creation failure
c. Session history upload failure
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗