8000 Unable to configure Ollama as an option. · Issue #154 · sst/opencode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unable to configure Ollama as an option. #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy stat 8000 ement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
humblecoder opened this issue Jun 16, 2025 · 4 comments
Closed

Unable to configure Ollama as an option. #154

humblecoder opened this issue Jun 16, 2025 · 4 comments
Assignees

Comments

@humblecoder
Copy link
OS: MacOS 15.5 (M1 Max)
Package:  opencode 0.1.62 (via Homebrew)

Having an issue very similar to #107 Can't even get ollama config to boot. Ollama is absolutely running. I use it for OpenWebUI, etc. I've tried both /v1 and /api but neither seems to make a difference.

//config.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "@ai-sdk/openai-compatible": {
      "name": "ollama",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "devstral": {
          "name": "devstral:latest"
        }
      }
    }
  }
}
Click to show full output ... ``` ❯ opencode --print-logs 2025-06-16T21:24:28 +22ms service=default version=0.1.62 args=--print-logs opencode 2025-06-16T21:24:28 +0ms service=app cwd=/Users/devuser/code/playground/blockchain-scanner-monorepo cre ating 2025-06-16T21:24:28 +2ms service=app git=/Users/devuser/code/playground/blockchain-scanner-monorepo git 2025-06-16T21:24:28 +2ms service=app name=provider registering service 2025-06-16T21:24:28 +0ms service=app name=config registering service 2025-06-16T21:24:28 +0ms service=config loaded 2025-06-16T21:24:28 +1ms service=models.dev refreshing 2025-06-16T21:24:28 +0ms service=provider init

█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀

┌ Add credential
2025-06-16T21:24:28 +1ms service=models.dev refreshing

◇ Select provider
│ Other

◇ Enter provider id
│ ollama

▲ This only stores a credential for ollama - you will need configure it in opencode.json, check the docs for examples.

◇ Enter your API key
│ ▪▪▪▪▪

└ Done

2025-06-16T21:24:34 +6422ms service=app cwd=/Users/devuser/code/playground/blockchain-scanner-monorepo creating
2025-06-16T21:24:34 +0ms service=app git=/Users/devuser/code/playground/blockchain-scanner-monorepo git
2025-06-16T21:24:34 +0ms service=app name=provider registering service
2025-06-16T21:24:34 +0ms service=app name=config registering service
2025-06-16T21:24:34 +0ms service=config loaded
2025-06-16T21:24:34 +1ms service=models.dev refreshing
2025-06-16T21:24:34 +0ms service=provider init
2025-06-16T21:24:34 +0ms service=provider providerID=ollama found
2025-06-16T21:24:34 +0ms service=app name=share registering service
2025-06-16T21:24:34 +0ms service=bus type=storage.write subscribing
2025-06-16T21:24:34 +0ms service=app name=bus registering service
2025-06-16T21:24:34 +38ms service=server method=GET path=/event request
2025-06-16T21:24:34 +0ms service=server event connected
2025-06-16T21:24:34 +1ms service=bus type=* subscribing
2025-06-16T21:24:34 +1ms service=server duration=2 response
2025-06-16T21:24:34 +1ms service=server method=POST path=/file_search request
2025-06-16T21:24:34 +2ms service=server method=POST path=/path_get request
2025-06-16T21:24:34 +1ms service=server duration=1 response
2025-06-16T21:24:34 +1ms service=server method=POST path=/provider_list request
2025-06-16T21:24:34 +1ms message=TypeError: undefined is not an object (evaluating 'Y.models') UnknownError
2025-06-16T21:24:34 +0ms service=server duration=1 response
2025-06-16T21:24:34 +4ms service=server duration=9 response
Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 66 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:26 +0x64
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:18 +0x1c
github.com/charmbracelet/bubbletea/v2.(*Program).recoverFromPanic(0x140001a9200, {0x10543cfe0, 0x1059edc90})
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:1134 +0xb0
github.com/charmbracelet/bubbletea/v2.(*Program).handleCommands.func1.1.1()
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:482 +0x40
panic({0x10543cfe0?, 0x1059edc90?})
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/panic.go:792 +0x124
github.com/sst/opencode/internal/tui.appModel.Init.(App).InitializeProvider.func2()
/home/runner/work/opencode/opencode/packages/tui/internal/app/app.go:78 +0x64
github.com/charmbracelet/bub2025-06-16T21:24:34 +38ms service=bus type=
unsubscribing
2025-06-16T21:24:34 +2ms service=server event disconnected

</details>
@GitMurf
Copy link
GitMurf commented Jun 16, 2025

Did you put the config.json in the root of your project (cwd) you are trying to use opencode in? See #152 as it does not read from the central config. You have to create a opencode.json in every project root you want to use opencode in.

Also looks like you did this in config.json but it must be opencode.json I believe.

@humblecoder
Copy link
Author
humblecoder commented Jun 16, 2025

Did you put the config.json in the root of your project (cwd) you are trying to use opencode in? See #152 as it does not read from the central config. You have to create a opencode.json in every project root you want to use opencode in.

Also looks like you did this in config.json but it must be opencode.json I believe.

Is this true for the Homebrew-installed (non-NPM) version? Also, on MacOS it definitely reads from ~/.local/shared/opencode as I regularly have to delete auth.json in order for it to get past prior failed configs.

That said, I did indeed try creating a "root-project-level" opencode.json but it had no discernible effect.

@thdxr
Copy link
Collaborator
thdxr commented Jun 17, 2025

so for config opencode.json needs to be in the project where you're running opencode

also check the updated example in the readme - i do have this working myself so must be some simpler error we should help catch

@thdxr thdxr self-assigned this Jun 17, 2025
@thdxr thdxr closed this as completed Jun 17, 2025
Copy link
Collaborator
thdxr commented Jun 17, 2025

closing this, readme should have all info to figure out your issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0