ProviderInitError when using Perplexity model in OpenCode #2346

Closed
opened 2026-02-16 17:35:13 -05:00 by yindo · 17 comments
Owner

Originally created by @skilledkitten on GitHub (Oct 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

When selecting a Perplexity model, in this case Perplexity Sonar, and sending any message you get a full screen error. See Screenshot below.

OpenCode version

0.15.28

Steps to reproduce

  1. Configure Perplexity API Key with "opencode auth login"
  2. Start opencode
  3. Select Perplexity Sonar as model
  4. Type anything in chat.

Screenshot and/or share link

Image

Operating System

macOS 26.0.1

Terminal

Ghostty

Originally created by @skilledkitten on GitHub (Oct 29, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description When selecting a Perplexity model, in this case Perplexity Sonar, and sending any message you get a full screen error. See Screenshot below. ### OpenCode version 0.15.28 ### Steps to reproduce 1. Configure Perplexity API Key with "opencode auth login" 2. Start opencode 3. Select Perplexity Sonar as model 4. Type anything in chat. ### Screenshot and/or share link <img width="912" height="744" alt="Image" src="https://github.com/user-attachments/assets/e7428cf7-a620-42d9-b973-8cb3d184c219" /> ### Operating System macOS 26.0.1 ### Terminal Ghostty
yindo added the bug label 2026-02-16 17:35:13 -05:00
yindo closed this issue 2026-02-16 17:35:14 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 29, 2025):

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

  • #1635: Similar ProviderInitError with full-screen display when using a different provider (Anthropic)
  • #2950: Identical ProviderInitError on Apple Silicon Mac with same macOS version (26.0.1), also occurs immediately when sending first message
  • #352: Provider initialization issues with model selection problems

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

@github-actions[bot] commented on GitHub (Oct 29, 2025): This issue might be a duplicate of existing issues. Please check: - #1635: Similar ProviderInitError with full-screen display when using a different provider (Anthropic) - #2950: Identical ProviderInitError on Apple Silicon Mac with same macOS version (26.0.1), also occurs immediately when sending first message - #352: Provider initialization issues with model selection problems Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

maybe the npm package listed in models.dev is incorrect for this model/provider

@rekram1-node commented on GitHub (Oct 29, 2025): maybe the npm package listed in models.dev is incorrect for this model/provider
Author
Owner

@Ka-lip commented on GitHub (Oct 31, 2025):

I got the same error and here is the print-logs. I am on Windows 11.

opencode run hello --print-logs
INFO  2025-10-31T10:19:34 +118ms service=default version=0.15.29 args=["run","hello","--print-logs"] opencode
INFO  2025-10-31T10:19:34 +0ms service=project directory=C:\Users\kchu fromDirectory
INFO  2025-10-31T10:19:34 +25ms service=config path=C:\Users\kchu\.config\opencode\config.json loading
INFO  2025-10-31T10:19:34 +0ms service=config path=C:\Users\kchu\.config\opencode\opencode.json loading
INFO  2025-10-31T10:19:34 +0ms service=config path=C:\Users\kchu\.config\opencode\opencode.jsonc loading
INFO  2025-10-31T10:19:34 +23ms service=bun cmd=["C:\\Users\\kchu\\AppData\\Local\\Microsoft\\WinGet\\Packages\\SST.opencode_Microsoft.Winget.Source_8wekyb3d8bbwe\\opencode.exe","add","@opencode-ai/plugin@0.15.29","--exact"] cwd=C:\Users\kchu\.config\opencode running
INFO  2025-10-31T10:19:34 +10ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
INFO  2025-10-31T10:19:34 +47ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
INFO  2025-10-31T10:19:36 +1161ms service=bus type=* subscribing
INFO  2025-10-31T10:19:36 +1ms service=bus type=session.updated subscribing
INFO  2025-10-31T10:19:36 +0ms service=bus type=message.updated subscribing
INFO  2025-10-31T10:19:36 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-31T10:19:36 +0ms service=format init
INFO  2025-10-31T10:19:36 +0ms service=bus type=file.edited subscribing
INFO  2025-10-31T10:19:36 +4ms service=session id=ses_5c6385d25ffeIAl6KBVgJEfHaW version=0.15.29 projectID=global directory=C:\Users\kchu title=New session - 2025-10-31T10:19:36.027Z time={"created":1761905976027,"updated":1761905976027} created
INFO  2025-10-31T10:19:36 +0ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls, lua-ls enabled LSP servers
INFO  2025-10-31T10:19:36 +46ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/plugin@0.15.29

[96.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-31T10:19:36 +3ms service=bus type=session.created publishing
INFO  2025-10-31T10:19:36 +0ms service=bus type=session.updated publishing
INFO  2025-10-31T10:19:36 +18ms service=bus type=message.part.updated subscribing
INFO  2025-10-31T10:19:36 +0ms service=bus type=session.error subscribing
INFO  2025-10-31T10:19:36 +3ms service=session.prompt session=ses_5c6385d25ffeIAl6KBVgJEfHaW prompt
INFO  2025-10-31T10:19:36 +16ms service=bus type=message.updated publishing
INFO  2025-10-31T10:19:36 +14ms service=bus type=message.part.updated publishing
INFO  2025-10-31T10:19:36 +20ms service=bus type=session.updated publishing
INFO  2025-10-31T10:19:36 +5ms service=models.dev file={} refreshing
INFO  2025-10-31T10:19:36 +40ms service=provider init
INFO  2025-10-31T10:19:36 +55ms service=provider providerID=perplexity found
INFO  2025-10-31T10:19:36 +0ms service=provider providerID=opencode found
INFO  2025-10-31T10:19:36 +0ms service=provider providerID=perplexity modelID=sonar getModel
INFO  2025-10-31T10:19:36 +2ms service=provider status=started providerID=perplexity getSDK
INFO  2025-10-31T10:19:37 +1281ms service=provider status=completed duration=1281 providerID=perplexity getSDK
ERROR 2025-10-31T10:19:37 +11ms service=default providerID=perplexity name=ProviderInitError message=ProviderInitError cause=TypeError: fn2 is not a function. (In 'fn2({
          name: provider.id,
          ...options2
        })', 'fn2' is undefined) stack=ProviderInitError: ProviderInitError
    at <anonymous> (src/provider/provider.ts:403:7)
    at processTicksAndRejections (native:7:39) fatal

Error: Unexpected error, check log file at  for more details
ProviderInitError: ProviderInitError
 data: {
  providerID: "perplexity",
},

      at src/provider/provider.ts:403:7
      at processTicksAndRejections (native:7:39)

433 |
434 |           const combined = signals.length > 1 ? AbortSignal.any(signals) : signals[0]
435 |
436 |           return fetch(input, {
437 |             ...rest,
438 |             signal: combined,
                          ^
TypeError: fn2 is not a function. (In 'fn2({
          name: provider.id,
          ...options2
        })', 'fn2' is undefined)
      at <anonymous> (src/provider/provider.ts:438:21)
@Ka-lip commented on GitHub (Oct 31, 2025): I got the same error and here is the print-logs. I am on Windows 11. ```cmd opencode run hello --print-logs INFO 2025-10-31T10:19:34 +118ms service=default version=0.15.29 args=["run","hello","--print-logs"] opencode INFO 2025-10-31T10:19:34 +0ms service=project directory=C:\Users\kchu fromDirectory INFO 2025-10-31T10:19:34 +25ms service=config path=C:\Users\kchu\.config\opencode\config.json loading INFO 2025-10-31T10:19:34 +0ms service=config path=C:\Users\kchu\.config\opencode\opencode.json loading INFO 2025-10-31T10:19:34 +0ms service=config path=C:\Users\kchu\.config\opencode\opencode.jsonc loading INFO 2025-10-31T10:19:34 +23ms service=bun cmd=["C:\\Users\\kchu\\AppData\\Local\\Microsoft\\WinGet\\Packages\\SST.opencode_Microsoft.Winget.Source_8wekyb3d8bbwe\\opencode.exe","add","@opencode-ai/plugin@0.15.29","--exact"] cwd=C:\Users\kchu\.config\opencode running INFO 2025-10-31T10:19:34 +10ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin INFO 2025-10-31T10:19:34 +47ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin INFO 2025-10-31T10:19:36 +1161ms service=bus type=* subscribing INFO 2025-10-31T10:19:36 +1ms service=bus type=session.updated subscribing INFO 2025-10-31T10:19:36 +0ms service=bus type=message.updated subscribing INFO 2025-10-31T10:19:36 +0ms service=bus type=message.part.updated subscribing INFO 2025-10-31T10:19:36 +0ms service=format init INFO 2025-10-31T10:19:36 +0ms service=bus type=file.edited subscribing INFO 2025-10-31T10:19:36 +4ms service=session id=ses_5c6385d25ffeIAl6KBVgJEfHaW version=0.15.29 projectID=global directory=C:\Users\kchu title=New session - 2025-10-31T10:19:36.027Z time={"created":1761905976027,"updated":1761905976027} created INFO 2025-10-31T10:19:36 +0ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls, lua-ls enabled LSP servers INFO 2025-10-31T10:19:36 +46ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca) installed @opencode-ai/plugin@0.15.29 [96.00ms] done stderr=Saved lockfile done INFO 2025-10-31T10:19:36 +3ms service=bus type=session.created publishing INFO 2025-10-31T10:19:36 +0ms service=bus type=session.updated publishing INFO 2025-10-31T10:19:36 +18ms service=bus type=message.part.updated subscribing INFO 2025-10-31T10:19:36 +0ms service=bus type=session.error subscribing INFO 2025-10-31T10:19:36 +3ms service=session.prompt session=ses_5c6385d25ffeIAl6KBVgJEfHaW prompt INFO 2025-10-31T10:19:36 +16ms service=bus type=message.updated publishing INFO 2025-10-31T10:19:36 +14ms service=bus type=message.part.updated publishing INFO 2025-10-31T10:19:36 +20ms service=bus type=session.updated publishing INFO 2025-10-31T10:19:36 +5ms service=models.dev file={} refreshing INFO 2025-10-31T10:19:36 +40ms service=provider init INFO 2025-10-31T10:19:36 +55ms service=provider providerID=perplexity found INFO 2025-10-31T10:19:36 +0ms service=provider providerID=opencode found INFO 2025-10-31T10:19:36 +0ms service=provider providerID=perplexity modelID=sonar getModel INFO 2025-10-31T10:19:36 +2ms service=provider status=started providerID=perplexity getSDK INFO 2025-10-31T10:19:37 +1281ms service=provider status=completed duration=1281 providerID=perplexity getSDK ERROR 2025-10-31T10:19:37 +11ms service=default providerID=perplexity name=ProviderInitError message=ProviderInitError cause=TypeError: fn2 is not a function. (In 'fn2({ name: provider.id, ...options2 })', 'fn2' is undefined) stack=ProviderInitError: ProviderInitError at <anonymous> (src/provider/provider.ts:403:7) at processTicksAndRejections (native:7:39) fatal Error: Unexpected error, check log file at for more details ProviderInitError: ProviderInitError data: { providerID: "perplexity", }, at src/provider/provider.ts:403:7 at processTicksAndRejections (native:7:39) 433 | 434 | const combined = signals.length > 1 ? AbortSignal.any(signals) : signals[0] 435 | 436 | return fetch(input, { 437 | ...rest, 438 | signal: combined, ^ TypeError: fn2 is not a function. (In 'fn2({ name: provider.id, ...options2 })', 'fn2' is undefined) at <anonymous> (src/provider/provider.ts:438:21) ```
Author
Owner

@OLYAHYAI commented on GitHub (Oct 31, 2025):

Same issue

Image
@OLYAHYAI commented on GitHub (Oct 31, 2025): Same issue <img width="2872" height="1013" alt="Image" src="https://github.com/user-attachments/assets/78b85d27-8ad6-4493-bfa3-21a675f0089d" />
Author
Owner

@JIbald commented on GitHub (Nov 2, 2025):

i have the same proplem with Anthropic.

@JIbald commented on GitHub (Nov 2, 2025): i have the same proplem with Anthropic.
Author
Owner

@rekram1-node commented on GitHub (Nov 2, 2025):

@JIbald that definitely shouldn't happen, can u run: opencode run hello --print-logs

Maybe add the --model anthropic/claude-sonnet-4-5 flag depending on default / last used model

@rekram1-node commented on GitHub (Nov 2, 2025): @JIbald that definitely shouldn't happen, can u run: `opencode run hello --print-logs` Maybe add the `--model anthropic/claude-sonnet-4-5` flag depending on default / last used model
Author
Owner

@sagar88826 commented on GitHub (Nov 3, 2025):

Image

I am also facing the same issue with Perplexity only.

@sagar88826 commented on GitHub (Nov 3, 2025): <img width="1918" height="577" alt="Image" src="https://github.com/user-attachments/assets/3742cb93-fa22-4a62-ad65-c06c0082e98e" /> I am also facing the same issue with Perplexity only.
Author
Owner

@JIbald commented on GitHub (Nov 3, 2025):

@rekram1-node thanks for the fast reply.
I just found out, that it might be due to dynamic linking, since I'm on nixos.
related issue can be found here
The logs seem to second this:

...
INFO  2025-11-03T20:11:39 +1ms service=bus type=storage.write publishing
INFO  2025-11-03T20:11:39 +0ms service=bus type=message.updated publishing
INFO  2025-11-03T20:11:39 +0ms service=bus type=storage.write publishing
INFO  2025-11-03T20:11:39 +0ms service=bus type=message.part.updated publishing
INFO  2025-11-03T20:11:39 +1ms service=bus type=storage.write publishing
INFO  2025-11-03T20:11:39 +0ms service=bus type=session.updated publishing
INFO  2025-11-03T20:11:39 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-5-20250929 getModel
INFO  2025-11-03T20:11:39 +0ms service=provider status=started providerID=anthropic getSDK
INFO  2025-11-03T20:11:39 +1ms service=provider status=completed duration=1 providerID=anthropic getSDK
INFO  2025-11-03T20:11:39 +0ms service=app name=lsp shutdown
INFO  2025-11-03T20:11:39 +0ms service=app name=session shutdown
ERROR 2025-11-03T20:11:39 +5ms service=default providerID=anthropic name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/user/.cache/opencode/node_modules/@ai-sdk/anthropic' from '/$bunfs/root/opencode' fatal
Error: Unexpected error, check log file at  for more details
@JIbald commented on GitHub (Nov 3, 2025): @rekram1-node thanks for the fast reply. I just found out, that it might be due to dynamic linking, since I'm on nixos. [related issue can be found here](https://github.com/sst/opencode/issues/462) The logs seem to second this: ``` ... INFO 2025-11-03T20:11:39 +1ms service=bus type=storage.write publishing INFO 2025-11-03T20:11:39 +0ms service=bus type=message.updated publishing INFO 2025-11-03T20:11:39 +0ms service=bus type=storage.write publishing INFO 2025-11-03T20:11:39 +0ms service=bus type=message.part.updated publishing INFO 2025-11-03T20:11:39 +1ms service=bus type=storage.write publishing INFO 2025-11-03T20:11:39 +0ms service=bus type=session.updated publishing INFO 2025-11-03T20:11:39 +0ms service=provider providerID=anthropic modelID=claude-sonnet-4-5-20250929 getModel INFO 2025-11-03T20:11:39 +0ms service=provider status=started providerID=anthropic getSDK INFO 2025-11-03T20:11:39 +1ms service=provider status=completed duration=1 providerID=anthropic getSDK INFO 2025-11-03T20:11:39 +0ms service=app name=lsp shutdown INFO 2025-11-03T20:11:39 +0ms service=app name=session shutdown ERROR 2025-11-03T20:11:39 +5ms service=default providerID=anthropic name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/user/.cache/opencode/node_modules/@ai-sdk/anthropic' from '/$bunfs/root/opencode' fatal Error: Unexpected error, check log file at for more details ```
Author
Owner

@rekram1-node commented on GitHub (Nov 3, 2025):

ah yeah that looks like it could be issue for u

I will note that perplexity may be a separate issue I dont tink the linked provider is able to work in opencode currently ill need to take a look

@rekram1-node commented on GitHub (Nov 3, 2025): ah yeah that looks like it could be issue for u I will note that perplexity may be a separate issue I dont tink the linked provider is able to work in opencode currently ill need to take a look
Author
Owner

@kamueone commented on GitHub (Nov 5, 2025):

same issue.

Image
@kamueone commented on GitHub (Nov 5, 2025): same issue. <img width="707" height="371" alt="Image" src="https://github.com/user-attachments/assets/fa2212e0-060d-4312-b048-0660a78531e8" />
Author
Owner

@27Bslash6 commented on GitHub (Nov 8, 2025):

Same on mac. Installed via bun

@27Bslash6 commented on GitHub (Nov 8, 2025): Same on mac. Installed via bun
Author
Owner

@FeernandoOFF commented on GitHub (Nov 12, 2025):

Same here. Hopefully it gets fixed soon, because I use this model for a custom saerch sub-agent :(

Image
@FeernandoOFF commented on GitHub (Nov 12, 2025): Same here. Hopefully it gets fixed soon, because I use this model for a custom `saerch` sub-agent :( <img width="835" height="417" alt="Image" src="https://github.com/user-attachments/assets/e236d976-5c62-42bd-805e-5d952417fd3b" />
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

Okay should be fixed u may want to: rm ~/.cache/opencode/models.json and then if u restart opencode it should work.

@rekram1-node commented on GitHub (Nov 12, 2025): Okay should be fixed u may want to: `rm ~/.cache/opencode/models.json` and then if u restart opencode it should work.
Author
Owner

@kamueone commented on GitHub (Nov 12, 2025):

Thank you. Thank you very much for fixing it.

works for me!

i just dont understand why its only showing this models:

perplexity/sonar-reasoning
perplexity/sonar
perplexity/sonar-pro
perplexity/sonar-reasoning-pro

on the webservice i have:

Sonar
GPT-5
Claude Sonnet 4.5
Gemini 2.5 Pro
Grok 4
Claude Opus 4.1max
o3-promax

Is this another issue?

@kamueone commented on GitHub (Nov 12, 2025): Thank you. Thank you very much for fixing it. works for me! i just dont understand why its only showing this models: perplexity/sonar-reasoning perplexity/sonar perplexity/sonar-pro perplexity/sonar-reasoning-pro on the webservice i have: Sonar GPT-5 Claude Sonnet 4.5 Gemini 2.5 Pro Grok 4 Claude Opus 4.1max o3-promax Is this another issue?
Author
Owner

@FeernandoOFF commented on GitHub (Nov 12, 2025):

Thank you so much! It works now :D

@FeernandoOFF commented on GitHub (Nov 12, 2025): Thank you so much! It works now :D
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

@kamueone we can add the other models, there is an api that tracks them: https://github.com/sst/models.dev

@rekram1-node commented on GitHub (Nov 12, 2025): @kamueone we can add the other models, there is an api that tracks them: https://github.com/sst/models.dev
Author
Owner

@kamueone commented on GitHub (Nov 12, 2025):

thx. i will try.

@kamueone commented on GitHub (Nov 12, 2025): thx. i will try.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2346