opencode icon indicating copy to clipboard operation
opencode copied to clipboard

opencode fails to start after chocolatey install: HTTPThread: the CA is invalid

Open Mattwmaster58 opened this issue 3 months ago • 6 comments

possibly related to: https://github.com/oven-sh/bun/issues/17325

INFO  2025-10-06T15:06:52 +70ms service=default version=0.14.3 args=[] opencode
INFO  2025-10-06T15:06:52 +0ms service=project directory=C:\Users\<my username> fromDirectory
INFO  2025-10-06T15:06:52 +7ms service=config path=C:\Users\<my username>\.config\opencode\config.json loading
INFO  2025-10-06T15:06:52 +1ms service=config path=C:\Users\<my username>\.config\opencode\opencode.json loading
INFO  2025-10-06T15:06:52 +0ms service=config path=C:\Users\<my username>\.config\opencode\opencode.jsonc loading
INFO  2025-10-06T15:06:52 +3ms service=plugin [email protected] loading plugin
INFO  2025-10-06T15:06:52 +0ms service=bun pkg=opencode-copilot-auth version=0.0.3 installing package using Bun's default registry resolution
INFO  2025-10-06T15:06:52 +0ms service=bun cmd=["C:\\ProgramData\\chocolatey\\lib\\opencode\\tools\\opencode.exe","add","--force","--exact","--cwd","C:\\Users\\<my username>\\.cache\\opencode","[email protected]"] cwd=C:\Users\<my username>\.cache\opencode running
INFO  2025-10-06T15:06:52 +51ms service=bun code=1 stdout=bun add v1.2.21 (7c45ed97)
 stderr=Resolving dependencies
HTTPThread: the CA is invalid
 done
ERROR 2025-10-06T15:06:52 +2ms service=default pkg=opencode-copilot-auth version=0.0.3 name=BunInstallFailedError message=BunInstallFailedError cause=Error: Command failed with exit code 1 stack=BunInstallFailedError: BunInstallFailedError
    at new NamedError (unknown:1:28)
    at new BunInstallFailedError (B:/~BUN/root/index.js:61352:14)
    at <anonymous> (B:/~BUN/root/index.js:62739:43)
    at processTicksAndRejections (native:7:39) fatal

Different than #1694 I think - opencode doesn't even start

Windows 11, behind Cloudflare WARP

NODE_TLS_REJECT_UNAUTHORIZED=0 doesn't fix this

Setting NODE_EXTRA_CA_CERTS (ex setx NODE_EXTRA_CA_CERTS C:\ProgramData\Cloudflare\installed_cert.pem) also doesn't work, which is what I would expect based on that linked bun issue - there doesn't seem to be an easy workaround here.

Mattwmaster58 avatar Oct 06 '25 13:10 Mattwmaster58

This issue might be a duplicate of existing issues. Please check:

  • #2765: Very similar BunInstallFailedError with HTTPThread CA certificate issues - shows "HTTPThread: could not find CA file: '/Users/{user}/bundle.pem'"
  • #1694: SSL certificate trust store issues with "unable to get local issuer certificate" error
  • #640: Corporate proxy SSL/certificate chain issues with "self signed certificate in certificate chain"
  • #923: Related certificate chain validation problems when accessing websites

These issues all relate to certificate validation problems in different network environments. The #2765 issue in particular shows the same HTTPThread error pattern you're experiencing.

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Oct 06 '25 13:10 github-actions[bot]

@itsrainingmani can probably help best here

rekram1-node avatar Oct 06 '25 13:10 rekram1-node

Weird. Let me investigate this 🫡

itsrainingmani avatar Oct 06 '25 13:10 itsrainingmani

I had this same error and the solution (for me) was to remove an invalid 'cafile' setting in my ~/.npmrc file. May work for you if you've ever set the cafile=xxx and then deleted xxx or something.

merlinr68 avatar Dec 10 '25 02:12 merlinr68

@merlinr68 do you know how to trace whether it's invalid? Only thing I recall is settings NODE_EXTRA_CA_CERTS

Mattwmaster58 avatar Dec 10 '25 03:12 Mattwmaster58

for me the choco install launches but is not functional:

Image

bun install -g opencode-ai is the recommended method for windows!

Hona avatar Jan 05 '26 23:01 Hona