Skip to content

server: auth and MCP connections fail after idle period #43444

Closed as not planned

Description

@Slickstef11

Description

After OpenCode remains running and the Mac is idle for several hours, returning to the session results in provider authentication failing and MCP servers not reconnecting. Restarting OpenCode usually takes multiple attempts before authentication works and all MCPs load again.

Recent logs show the provider failure:

Failed to drain Session ... Invalid API key.

At the same time, every remote MCP repeatedly fails to reconnect:

mcp connect failed ... getaddrinfo ENOTFOUND mcp.granola.ai
mcp connect failed ... getaddrinfo ENOTFOUND mcp.apollo.io
mcp connect failed ... getaddrinfo ENOTFOUND mcp.posthog.com
mcp connect failed ... getaddrinfo ENOTFOUND circleback.ai
mcp connect failed ... getaddrinfo ENOTFOUND api.us-west-2.aws.dash0.com
mcp connect failed ... salesforce ... MCP error -32603: fetch failed

This started after a recent OpenCode update and happens consistently after leaving OpenCode idle for a few hours. Once recovery succeeds, opencode mcp list shows all six servers connected.

Plugins

./plugins/agent-arcade.tsx

OpenCode version

1.18.16 (release; issue began after an update)

Steps to reproduce

  1. Start OpenCode with remote MCP servers configured.
  2. Leave OpenCode running and the Mac idle for several hours.
  3. Return to the existing session and send a prompt.
  4. Observe provider authentication failing and MCP connection errors.
  5. Restart OpenCode; multiple restarts may be required before MCPs reconnect.

Expected behavior

The existing provider session remains authenticated, and MCP servers reconnect automatically after the machine resumes or network access returns.

Screenshot and/or share link

Not available. Relevant redacted log excerpts are included above.

Operating System

Darwin 24.6.0, arm64 (macOS)

Terminal

Ghostty (TERM=xterm-256color, COLORTERM=truecolor), shell /bin/zsh

Activity

  1. Tarquinen commented on Oct 20, 2026

    @Tarquinen
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

No one assigned

    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