ollama - 💡(How to fix) Fix ollama launch opencode generates invalid OpenCode config when local models have context length but no max output tokens [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error: 4 of 5 requests failed

Root Cause

Root cause: cmd/launch/opencode.go buildModelEntries() emits: "limit": { "context": 262144 } when model.ContextLength > 0 but model.MaxOutputTokens == 0.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

What is the issue?

Ollama version: 0.30.0 OpenCode version: 1.15.13 macOS

Steps:

  1. Have local Ollama models, e.g. qwen3.6:35b-a3b
  2. Run: ollama launch opencode
  3. Select the model

Expected: OpenCode TUI starts.

Actual: OpenCode fails during startup: Error: 4 of 5 requests failed Affected startup requests: config.providers, provider.list, app.agents, config.get

OpenCode log shows: ConfigInvalidError / SchemaError: Missing key at ["provider"]["ollama"]["models"][...]["limit"]["output"]

Root cause: cmd/launch/opencode.go buildModelEntries() emits: "limit": { "context": 262144 } when model.ContextLength > 0 but model.MaxOutputTokens == 0.

OpenCode expects limit.output when limit is present.

Suggested fix: When generating OpenCode model entries, either:

  • include both limit.context and limit.output, using a sane default for output when MaxOutputTokens is unknown, or
  • omit limit entirely unless both fields are known, or
  • fetch/derive max output tokens for local models.

Relevant log output

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.30.0

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING