Skip to content

An argument failure is reported to the model as an execution failure #131

Closed

Description

@shibayan

What happens

When a tool call's arguments fail to parse or fail schema validation, the result handed back to the model reads:

Error: Function failed.

That is the same text a tool that threw during execution produces. The model cannot tell from the result whether to retry with corrected arguments or to stop calling the tool, which is the one distinction that changes what it should do next.

Python answers an argument failure with its own text (_tools.py, the argument-resolution branch):

Error: Argument parsing failed.

Go does not distinguish — agent/harness/toolautocall/autocall.go maps every failure status other than "not found" to Error: Function failed., with no argument branch. The .NET counterpart ships in a NuGet package outside the local mirror and has not been read.

The declared order of authority is .NET, then Python, then Go. With .NET unread, Python is the highest-ranked implementation that has an opinion here, and it distinguishes. This was noticed while fixing the UserInputRequiredException marker and deliberately left out of that change's scope.

Why it matters beyond parity

The two failures call for opposite responses. A schema violation is worth retrying with different arguments; a function that threw usually is not. Collapsing them removes the signal the model would act on.

Required implementation

  • Answer an argument parse or validation failure with its own result text, matching Python's wording.
  • Leave the execution-failure text, the not-found text and the success text unchanged.
  • Keep the detailed-error behaviour: when detailed errors are on, the underlying message is appended the same way it is for an execution failure.
  • Read the .NET FunctionInvokingChatClient before settling the wording, since it outranks Python; if it agrees with Go, record the three-way split and the choice rather than following Python silently.

Acceptance criteria

  • A reproduction-first test drives an argument failure and asserts the exact result text, failing before the change.
  • An execution failure, a not-found call and a successful call keep their current exact texts, each pinned.
  • Detailed errors on and off are covered for the argument-failure path.
  • The .NET behaviour is read and recorded, whichever way it points.
  • The wire-visible text change is listed in CHANGELOG.md.
  • pnpm check passes.

Explicitly out of scope

The not_found result's exception marker. Python sets it from str(KeyError(...)), which carries the quotes KeyError.__str__ adds; matching that byte-for-byte would import a Python repr artifact rather than a protocol fact. Current behaviour stays.

Activity

  1. added
    coreUsage: [Issues, PRs], Target: packages/core
    on Aug 31, 2026
  2. added theissue type on Aug 31, 2026
  3. self-assigned this
    on Sep 1, 2026
  4. added a commit that references this issue on Sep 1, 2026
    df85aba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreUsage: [Issues, PRs], Target: packages/core

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions