You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No retry on transient TLS errors: "unknown certificate verification error" #43864
Problem: When the TCP connection to the provider is reset mid-TLS-handshake (degraded route, ~20% packet loss measured with curl to the same endpoint), Bun surfaces Error: unknown certificate verification error from doStream. None of RETRYABLE_MESSAGE_PATTERNS in packages/opencode/src/session/retry.ts match this message, so opencode aborts the agent run instead of retrying. 45 occurrences in my logs over 2 weeks.
Fix: PR adds TLS handshake/certificate verification patterns to the retryable list — these are transport-level transient failures, same class as econnreset/socket hang up
Plugins
No plugins. Custom provider config only: zai-coding-plan (z.ai endpoint) in ~/.config/opencode/opencode.json
OpenCode version
1.18.20
Steps to reproduce
Configure the zai-coding-plan provider (endpoint https://api.z.ai)
From a network with a degraded route to api.z.ai, run any prompt
When the TCP connection is reset mid-TLS-handshake, the run fails immediately with Error: unknown certificate verification error — no retry attempt is shown
Route degradation is verifiable outside opencode: for i in $(seq 1 15); do curl -sS -o /dev/null -w "%{http_code}\n" --max-time 10 https://api.z.ai/api/coding/paas/v4/models; done
→ ~3/15 requests fail with "Connection timed out", while openssl s_client -connect api.z.ai:443 verifies the certificate OK every time —
i.e. the cert is valid, the transport is flaky.
Since openssl s_client -connect api.z.ai:443 verifies fine every time but the run still dies with unknown certificate verification error, it isn't the cert, it's the handshake getting reset mid-way, and that ~20% packet loss lines up with it. If you're behind a proxy, double check HTTP(S)_PROXY isn't injecting its own CA, a transparent MITM proxy turning a reset into a bogus cert failure is exactly how this presents. Routing api.z.ai through a stabler path (or a VPN) should cut the false positives way down while the retry.ts fix lands.
Activity
github-actions commentedon Aug 21, 2026
This issue might be a duplicate of existing issues. Please check:
unknown certificate verification errorsymptomIf your issue is distinct, please add context explaining how it differs.
MilkyWay008 commentedon Aug 21, 2026
Since
openssl s_client -connect api.z.ai:443verifies fine every time but the run still dies withunknown certificate verification error, it isn't the cert, it's the handshake getting reset mid-way, and that ~20% packet loss lines up with it. If you're behind a proxy, double checkHTTP(S)_PROXYisn't injecting its own CA, a transparent MITM proxy turning a reset into a bogus cert failure is exactly how this presents. Routing api.z.ai through a stabler path (or a VPN) should cut the false positives way down while the retry.ts fix lands.thdxr commentedon Oct 11, 2026
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊