Skip to content

fix(providers): name the unexpected properties in tool argument validation errors - #378

Merged
liuedcson merged 1 commit into
mainfrom
fix/tool-validation-error-detail
Nov 30, 2026
Merged

liuedcson merged 1 commit into
mainfrom
fix/tool-validation-error-detail

Conversation

@liuedcson

Copy link
Copy Markdown
Collaborator

Problem

When a tool call carries a field outside a strict schema, the validation error only names the path:

items.1: must not have additional properties

The caller cannot tell which field to remove, so a model that sent a wrong field tends to repeat it on the next turn.

Change

validateToolArguments now appends the offending property names, which the validator already reports in params.additionalProperties:

items.1: must not have additional properties: note
  • packages/providers/src/utils/validation.ts: add formatValidationMessage and use it when building the error list.
  • packages/providers/test/validation.test.ts: cover a nested object entry.

Validation

  • pnpm exec vitest --run test/validation.test.ts in packages/providers: 10 passed.
  • pnpm run check: all boundary checks and tsgo --noEmit pass.

Not in this change

Enum failures still repeat the same path without listing the allowed values, and the allowed fields of the object are not listed yet.

…ation errors

An additionalProperties failure reported only the path, so a caller that sent an unknown field could not tell which one to remove. Append the offending property names taken from the validator error params, and cover a nested and a top-level case in the validation test.
@liuedcson
liuedcson merged commit 17f98e9 into main Nov 30, 2026
2 checks passed
@liuedcson
liuedcson deleted the fix/tool-validation-error-detail branch November 30, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant