opencode
opencode copied to clipboard
[BUG] Custom provider initialization fails with "fn3 is not a function
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
- Add the following to
opencode.json:
{
"provider": {
"custom": {
"api": "openai",
"options": {
"apiKey": "xxx",
"baseURL": "http://localhost:8045/v1"
},
"models": { ... }
}
}
}
- Run
opencode run "hello" --model custom/model-name - 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