anomalyco / anomalyco/opencode

OpenCode Go: "socket connection was closed unexpectedly" / "unknown certificate verification error" on all models

Open
#42,479 3 comments 0 reactions 1 assignee View on GitHub

@fwang is already working on this.

Since Aug 14, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

I'm currently unable to use any model through the OpenCode Go provider.

The issue affects multiple models, not just DeepSeek. For example:

  • deepseek-v4-flash → socket connection was closed unexpectedly
  • gpt-5.6-luna → socket connection was closed unexpectedly
  • gpt-5.6-luna also intermittently returns "unknown certificate verification error"

The relevant error from the OpenCode log is:

AI_APICallError: Cannot connect to API: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

I also got this more specific error:

Error: unknown certificate verification error

This happens consistently with the opencode-go provider.

I tested HTTPS connectivity to opencode.ai directly using curl, and the connection succeeds with HTTP/2 200, so general HTTPS/TLS connectivity from my Mac appears to be working.

There are also no proxy-related environment variables configured.

Plugins

None

OpenCode version

1.18.18

Steps to reproduce
  1. Open OpenCode 1.18.18.
  2. Use the OpenCode Go provider.
  3. Select any available model (tested with deepseek-v4-flash and gpt-5.6-luna).
  4. Send any prompt.
  5. The request fails with:
    "Cannot connect to API: The socket connection was closed unexpectedly"
  6. Retrying eventually produces:
    "unknown certificate verification error"
Screenshot and/or share link

No response

Operating System

macOS (Apple Silicon)

Terminal

vsc extension

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.