nil pointer dereference for openai-compatible auth and local configuration #413

Closed
opened 2026-02-16 17:26:39 -05:00 by yindo · 2 comments
Owner

Originally created by @manuschillerdev on GitHub (Jul 1, 2025).

Originally assigned to: @thdxr on GitHub.

I tried adding an auth key for a local ollama model, but got a SIGSEGV after trying to start opencode with the updated config.

System:

                    'c.          User@***
                 ,xNMM.          ------------------
               .OMMMMo           OS: macOS 15.5 24F74 arm64
               OMMM0,            Host: Mac14,5
     .;loddo:' loolloddol;.      Kernel: 24.5.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 36 days, 3 hours, 47 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 419 (brew), 54 (nix-user)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1512x982, 1920x1080, 1920x1080
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Rectangle
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    Terminal: ghostty
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   CPU: Apple M2 Max
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   GPU: Apple M2 Max
    kMMMMMMMMMMMMMMMMMMMMMMd     Memory: 9793MiB / 65536MiB
     ;KMMMMMMMWXXWMMMMMMMk.
       .cooc,.    .,coo:.

Version:

opencode --version
0.1.48

config:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "deepseek-r1:14b": {}
      }
    }
  }
}

Steps to reproduce:

opencode auth login

┌  Add credential
│
◇  Select provider
│  Other
│
◇  Enter provider - must match @ai-sdk/<provider>
│  openai-compatible
│
◇  Enter your API key
│  ▪▪▪
│
└  Done

❯ opencode
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1027acea8]

goroutine 1 [running]:
github.com/sst/opencode/internal/app.New({0x102ed55a8, 0x14000533d60}, {0x140007057d0, 0x7}, 0x14000590250)
        /home/runner/work/opencode/opencode/packages/tui/internal/app/app.go:64 +0x268
main.main()
        /home/runner/work/opencode/opencode/packages/tui/cmd/opencode/main.go:59 +0x4dc
``
Originally created by @manuschillerdev on GitHub (Jul 1, 2025). Originally assigned to: @thdxr on GitHub. I tried adding an auth key for a local ollama model, but got a `SIGSEGV` after trying to start opencode with the updated config. System: ``` 'c. User@*** ,xNMM. ------------------ .OMMMMo OS: macOS 15.5 24F74 arm64 OMMM0, Host: Mac14,5 .;loddo:' loolloddol;. Kernel: 24.5.0 cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 36 days, 3 hours, 47 mins .KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 419 (brew), 54 (nix-user) XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.9 ;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 1512x982, 1920x1080, 1920x1080 :MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua .MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Rectangle kMMMMMMMMMMMMMMMMMMMMMMMMWd. Terminal: ghostty .XMMMMMMMMMMMMMMMMMMMMMMMMMMk CPU: Apple M2 Max .XMMMMMMMMMMMMMMMMMMMMMMMMK. GPU: Apple M2 Max kMMMMMMMMMMMMMMMMMMMMMMd Memory: 9793MiB / 65536MiB ;KMMMMMMMWXXWMMMMMMMk. .cooc,. .,coo:. ``` Version: ``` opencode --version 0.1.48 ``` config: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "deepseek-r1:14b": {} } } } } ``` Steps to reproduce: ``` opencode auth login ┌ Add credential │ ◇ Select provider │ Other │ ◇ Enter provider - must match @ai-sdk/<provider> │ openai-compatible │ ◇ Enter your API key │ ▪▪▪ │ └ Done ❯ opencode panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1027acea8] goroutine 1 [running]: github.com/sst/opencode/internal/app.New({0x102ed55a8, 0x14000533d60}, {0x140007057d0, 0x7}, 0x14000590250) /home/runner/work/opencode/opencode/packages/tui/internal/app/app.go:64 +0x268 main.main() /home/runner/work/opencode/opencode/packages/tui/cmd/opencode/main.go:59 +0x4dc ``
yindo closed this issue 2026-02-16 17:26:39 -05:00
Author
Owner

@thdxr commented on GitHub (Jul 1, 2025):

can you do opencode provider list

@thdxr commented on GitHub (Jul 1, 2025): can you do `opencode provider list`
Author
Owner

@manuschillerdev commented on GitHub (Jul 1, 2025):

I updated to version 0.1.173, and the error is gone. Everything works fine now

@manuschillerdev commented on GitHub (Jul 1, 2025): I updated to version `0.1.173`, and the error is gone. Everything works fine now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#413