opencode icon indicating copy to clipboard operation
opencode copied to clipboard

replaceAll error when value is omitted or not boolean causes invalid_type error

Open shirokun20 opened this issue 6 months ago • 8 comments

🐛 Bug Report: replaceAll causes invalid_type error when omitted or not boolean

Description

When using replaceAll in an Opencode rule, an error occurs if the field is present but left undefined or not explicitly set to a boolean value (true or false).

Error output:

{
  "code": "invalid_type",
  "expected": "boolean",
  "received": "undefined",
  "path": ["replaceAll"],
  "message": "Required"
}

🖥️ Environment

  • Opencode Version: v0.2.33
  • OS: macOS 15.5

shirokun20 avatar Jul 12 '25 06:07 shirokun20

How to fix that?

shirokun20 avatar Jul 12 '25 06:07 shirokun20

what model?

thdxr avatar Jul 12 '25 15:07 thdxr

Open AI

shirokun20 avatar Jul 14 '25 05:07 shirokun20

finish fix?

shirokun20 avatar Jul 15 '25 06:07 shirokun20

Same error here

nacholupotti avatar Jul 16 '25 16:07 nacholupotti

On 1.0.98 and gemini 3 pro preview I get:

Edit <file in question> [replaceAll=false]
The edit tool was called with invalid arguments: [
  {
    "expected": "boolean",
    "code": "invalid_type",
    "path": [
      "replaceAll"
    ],
    "message": "Invalid input: expected boolean, received string"
  }
].
Please rewrite the input so it satisfies the expected schema.

It would proceed leaving replaceAll out and actually do something. Happends ca. 50% of the time.

ahirner avatar Nov 24 '25 12:11 ahirner

Same here using Gemini 3 Pro Preview through GitHub Copilot. It eventually figures things out but it wastes a lot of time with this problem and it happens multiple times per prompt.

gugahoi avatar Dec 15 '25 23:12 gugahoi

ill add a fix for this

rekram1-node avatar Dec 15 '25 23:12 rekram1-node