opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[BUG] Custom provider initialization fails with "fn3 is not a function

Open boyan250422-code opened this issue 3 days ago • 1 comments

Description

Description

Attempting to use a custom provider configuration results in a TypeError: fn3 is not a function during provider initialization. The custom provider feature appears to be incomplete or has compatibility issues.

Reproduction Steps

  1. Add the following to opencode.json:
{
  "provider": {
    "custom": {
      "api": "openai",
      "options": {
        "apiKey": "xxx",
        "baseURL": "http://localhost:8045/v1"
      },
      "models": { ... }
    }
  }
}
  1. Run opencode run "hello" --model custom/model-name
  2. Error occurs during provider initialization

Error Message

ProviderInitError: ProviderInitError
data: { providerID: "custom" }

TypeError: fn3 is not a function

Environment

  • OS: Windows 11
  • opencode version: v1.0.150 (also affects v1.0.210)
  • oh-my-opencode version: v2.14.0

Root Cause

opencode attempts to dynamically load a custom provider module but cannot find the corresponding create* function. The custom provider functionality is either incomplete or has compatibility issues.

Workaround

Use built-in provider with overridden options:

{
  "provider": {
    "anthropic": {
      "options": {
        "apiKey": "your-api-key",
        "baseURL": "http://localhost:8045/v1"
      }
    }
  },
  "model": "anthropic/claude-sonnet-4-5"
}

Expected Behavior

Custom provider should initialize correctly according to the configuration.

Additional Notes

This workaround works for most use cases but limits flexibility when users truly need custom provider definitions.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

boyan250422-code avatar Jan 11 '26 12:01 boyan250422-code