Skip to content

OpenCode hangs indefinitely when sending requests to Anthropic via Oauth login #1618

Closed

Description

@plappag

Environment

  • OpenCode Version: 0.3.130
  • OS: Windows with WSL2 - Linux 6.6.87.2-microsoft-standard-WSL2
  • Platform: linux x86-64

Issue Description

OpenCode hangs indefinitely when attempting to send messages to the Anthropic API. This was working before but
suddenly stopped working. Authentication works correctly, models are detected, but any actual API request never
completes.

Steps to Reproduce

  1. Fresh install: curl -fsSL https://opencode.ai/install | bash
  2. Authentication successful: opencode auth login (OAuth flow completed)
  3. Verified auth: opencode auth list ✅ Shows Anthropic provider configured
  4. Started OpenCode: opencode --print-logs --log-level DEBUG
  5. Sent any message → Hangs forever

What Works ✅

  • Installation and setup
  • Authentication (OAuth tokens present in ~/.local/share/opencode/auth.json)
  • Provider detection (opencode auth list shows Anthropic)
  • Model detection (logs show claude-sonnet-4-20250514 and claude-3-5-haiku-20241022 found)
  • TUI initialization
  • Session creation and management

What Fails ❌

  • Any actual API request to Anthropic hangs indefinitely
  • No error messages or timeouts
  • Process must be killed manually

Debug Information

Auth Status:

{
  "anthropic": {
    "type": "oauth",
    "refresh": "sk-ant-ort01-[REDACTED]",
    "access": "sk-ant-oat01-[REDACTED]",
    "expires": 1754419110820
  }
}

Last Log Entries Before Hang:
INFO  2025-08-05T10:53:07 +1ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 getModel
INFO  2025-08-05T10:53:07 +0ms service=provider status=started providerID=anthropic getSDK
INFO  2025-08-05T10:53:07 +84ms service=provider status=completed duration=84 providerID=anthropic getSDK
INFO  2025-08-05T10:53:07 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-20250514 found
INFO  2025-08-05T10:53:07 +3ms service=session session=ses_78622ef09ffe1I46xY5lno4Sx4
sessionID=ses_78622ef09ffe1I46xY5lno4Sx4 locking
INFO  2025-08-05T10:53:07 +3ms service=provider providerID=anthropic modelID=claude-3-5-haiku-20241022 getModel
INFO  2025-08-05T10:53:07 +0ms service=provider status=started providerID=anthropic getSDK
INFO  2025-08-05T10:53:07 +0ms service=provider status=completed duration=0 providerID=anthropic getSDK
INFO  2025-08-05T10:53:07 +0ms service=provider providerID=anthropic modelID=claude-3-5-haiku-20241022 found
INFO  2025-08-05T10:53:08 +986ms service=bus type=storage.write publishing
INFO  2025-08-05T10:53:08 +0ms service=bus type=session.updated publishing
[HANGS HERE - NO FURTHER LOGS]

Additional Context

This was working fine previously but suddenly stopped working. We're on Windows using WSL2. Happy to test any
fixes or provide additional debugging information if needed.

Activity

  1. self-assigned this
    on Aug 5, 2025
  2. thdxr commented on Aug 5, 2025

    @thdxr
    Member

    i need full logs can you do opencode run hey --print-logs

  3. thdxr commented on Aug 5, 2025

    @thdxr
    Member

    btw can you test if it works with an api key?

  4. plappag commented on Aug 5, 2025

    @plappag
    Author

    Ok, not entirely sure what happened, it works now with opencode --hostname 0.0.0.0, it also worked on Windows side when I downloaded the binary. Hope this helps someone, if it was my fault my bad haha 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions