termmate icon indicating copy to clipboard operation
termmate copied to clipboard

[Bug] "Not logged in" when using Claude.ai subscription — `claude --print` doesn't accept OAuth session

Open udoschmitz opened this issue 6 months ago • 2 comments

Summary

TermMate reports "Not logged in · Please run /login" on every message, even though the user is authenticated with a Claude.ai subscription. The underlying cause is that TermMate invokes claude --print --output-format=stream-json ... (non-interactive mode), which does not accept the OAuth session created by the standard claude login flow.

Environment

  • TermMate: installed via Package Control
  • Sublime Text: 4
  • macOS: 15.7.6 (Sequoia), Apple Silicon
  • Claude Code CLI: 2.1.146, installed at ~/.local/bin/claude
  • Auth method: Claude.ai subscription (browser OAuth via claude in terminal)
  • ANTHROPIC_API_KEY: not set

Steps to Reproduce

  1. Install Claude Code CLI and authenticate via browser OAuth:
    curl -fsSL https://claude.ai/install.sh | sh
    claude  # completes browser OAuth flow, "Login successful"
    
  2. Confirm interactive mode works: claude opens a working chat session
  3. Install TermMate via Package Control
  4. Open Command Palette → "TermMate: Start Chat"
  5. Send any message

Expected Behavior

TermMate uses the existing Claude.ai subscription session to process messages.

Actual Behavior

> Hello
Not logged in · Please run /login

> /login
/login isn't available in this environment.

Root Cause

TermMate's claude_agent.py invokes the CLI as follows:

cmd = [
    self.cli_path,
    "--print",
    "--output-format=stream-json",
    "--input-format=stream-json",
    "--replay-user-messages",
    "--verbose",
    "--permission-prompt-tool=stdio",
]

Running claude --print in a terminal confirms the issue is not specific to TermMate's subprocess — it fails identically when called directly:

$ claude -p "Say: OK"
Not logged in · Please run /login

So claude --print (non-interactive/pipeline mode) does not recognize the OAuth session that claude (interactive mode) uses. This appears to be a mismatch between how the two modes handle authentication.

Impact

TermMate is completely unusable for any user who authenticated via the standard Claude.ai subscription flow. It only works if ANTHROPIC_API_KEY is set — which is not mentioned anywhere in the README, and which subscription users don't normally have.

Possible Fix

Investigate whether claude --print can be made to accept the existing OAuth session, or document clearly that TermMate currently requires ANTHROPIC_API_KEY and cannot be used with a Claude.ai subscription alone.

udoschmitz avatar May 21 '26 08:05 udoschmitz

This issue is caused by recent change of the claude code CLI.

--print parameter now ignores the OAuth session token and strictly requires the API_KEY to be set. Anthropic claude-agent-sdk-python has already dropped the --print flag to this change.

synote avatar May 21 '26 23:05 synote

the error have been fixed https://github.com/flashmodel/termmate/releases/tag/0.3.2

synote avatar Jul 03 '26 13:07 synote