Skip to content

fix: handle invalid maxOutputTokens value (0 or undefined)#1

Open
Jedeiah wants to merge 426 commits into
devfrom
fix/maxOutputTokens-validation
Open

fix: handle invalid maxOutputTokens value (0 or undefined)#1
Jedeiah wants to merge 426 commits into
devfrom
fix/maxOutputTokens-validation

Conversation

@Jedeiah
Copy link
Copy Markdown
Owner

@Jedeiah Jedeiah commented Apr 11, 2026

Fixes anomalyco#21858
Fixes anomalyco#21522

What

  • Fixes maxOutputTokens returning 0 when model.limit.output is 0, undefined, or negative
  • Returns OUTPUT_TOKEN_MAX (32000) as fallback when model output limit is invalid

Why

  • When plugins pass maxOutputTokens=0 via chat.params hook, OpenCode 1.4.0+ requires >= 1
  • This causes "maxOutputTokens must be >= 1" error for local providers like Ollama

Verification

  • Added 5 unit tests for maxOutputTokens function covering edge cases
  • All tests pass

kitlangton and others added 30 commits April 15, 2026 16:35
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
…d for github copilot (anomalyco#22567)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
jlongster and others added 30 commits April 16, 2026 23:35
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

Successfully merging this pull request may close these issues.

[BUG] Ollama integration: Invalid maxOutputTokens error Invalid argument for parameter maxOutputTokens: maxOutputTokens must be >= 1