Skip to content

prompt is too long when replacing in a file. #5478

Closed as duplicate
Closed as duplicate

Description

@nachose

Description

When trying to get some output into a file, seems like the generated output is too long:

~ Preparing edit...
The edit tool was called with invalid arguments: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"filePath"
],
"message": "Invalid input: expected string, received undefined"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
"oldString"
],
"message": "Invalid input: expected string, received undefined"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
"newString"
],
"message": "Invalid input: expected string, received undefined"
}
].
Please rewrite the input so it satisfies the expected schema.
I need to provide both oldString and newString parameters. Let me fix this error by providing both.
Let me fix the error by providing both oldString and newString parameters in the edit function call.
prompt is too long: 211846 tokens > 200000 maximum

OpenCode version

1.0.151

Steps to reproduce

  1. Ask about some subject (programming generates longer outputs).
  2. Ask to write the results to a file.

Screenshot and/or share link

No response

Operating System

Ubuntu

Terminal

No response

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 13, 2025
  2. github-actions commented on Dec 13, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    All of these appear to address the same root cause: the prompt context growing too large and exceeding the model's token limit. Your issue specifically mentions this happens when asking the edit tool to replace content in a file when the generated output is too long.

    Feel free to ignore if your specific case with file replacement is distinct from these other reports.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions