Skip to content

Write tool schema field ordering causes truncation failures with local models #29940

Closed as not planned

Description

@RheagalFire

Description

When local models write large files, they generate content before filePath (matching the schema declaration order). If they exhaust their token budget on content, they never
reach filePath, resulting in SchemaError(Missing key at ["filePath"]). Swapping the field order so filePath is declared first fixes this.

Related: #18108

Plugins

None

OpenCode version

Latest dev

Steps to reproduce

  1. Configure a local model (e.g. via Ollama/LiteLLM) with limited output tokens
  2. Ask it to write a large file
  3. The model generates content first, runs out of tokens, never produces filePath
  4. Results in SchemaError(Missing key at ["filePath"])

Screenshot and/or share link

N/A

Operating System

macOS

Terminal

Terminal.app

Activity

  1. github-actions commented on Jul 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions