GPT-4.1 tool parameter confusion #708

Closed
opened 2026-02-16 17:27:58 -05:00 by yindo · 0 comments
Owner

Originally created by @scaryrawr on GitHub (Jul 14, 2025).

It looks like descriptions have things like old_string, where the parameter name is actually oldString. This confuses GPT-4.1 leading to errors like:

{
  "error": {
    "name": "UnknownError",
    "data": {
      "type": "AI_InvalidToolInputError",
      "description": "Invalid input for tool edit: Type validation failed",
      "tool_input": {
        "filePath": "[REDACTED_PATH]/Cargo.toml",
        "old_string": "[dependencies]\nglob = \"0.3\"\nregex = \"1\"\nlazy_static = \"1\"\nnapi = { version = \"2.16.0\", default-features = false, features = [\"napi4\"] }\nnapi-derive = \"2.16.0\"\n",
        "newString": "[dependencies]\nglob = \"0.3\"\nregex = \"1\"\nlazy_static = \"1\"\nthiserror = \"1\"\nnapi = { version = \"2.16.0\", default-features = false, features = [\"napi4\"] }\nnapi-derive = \"2.16.0\"\n"
      },
      "validation_errors": [
        {
          "code": "invalid_type",
          "expected": "string",
          "received": "undefined",
          "path": ["oldString"],
          "message": "Required"
        }
      ]
    }
  }
}

Originally created by @scaryrawr on GitHub (Jul 14, 2025). It looks like descriptions have things like `old_string`, where the parameter name is actually `oldString`. This confuses GPT-4.1 leading to errors like: ```json { "error": { "name": "UnknownError", "data": { "type": "AI_InvalidToolInputError", "description": "Invalid input for tool edit: Type validation failed", "tool_input": { "filePath": "[REDACTED_PATH]/Cargo.toml", "old_string": "[dependencies]\nglob = \"0.3\"\nregex = \"1\"\nlazy_static = \"1\"\nnapi = { version = \"2.16.0\", default-features = false, features = [\"napi4\"] }\nnapi-derive = \"2.16.0\"\n", "newString": "[dependencies]\nglob = \"0.3\"\nregex = \"1\"\nlazy_static = \"1\"\nthiserror = \"1\"\nnapi = { version = \"2.16.0\", default-features = false, features = [\"napi4\"] }\nnapi-derive = \"2.16.0\"\n" }, "validation_errors": [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": ["oldString"], "message": "Required" } ] } } } ```
yindo closed this issue 2026-02-16 17:27:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#708