Skip to content

include unknown keys in noUnknown error message#3

Open
gitramirez wants to merge 1 commit into
base-show-unknown-keys-in-errors-r-11722390from
gitramirez/show-unknown-keys-in-errors-r-11722390
Open

include unknown keys in noUnknown error message#3
gitramirez wants to merge 1 commit into
base-show-unknown-keys-in-errors-r-11722390from
gitramirez/show-unknown-keys-in-errors-r-11722390

Conversation

@gitramirez
Copy link
Copy Markdown

@gitramirez gitramirez commented Feb 17, 2026

Note

Low Risk
Localized behavior change to validation error formatting with a small update to noUnknown error construction; low risk aside from potential snapshot/string-compare test updates downstream.

Overview
Improves object().noUnknown() validation failures by including the actual unknown keys in the generated error message.

This updates the default locale.object.noUnknown template to reference an ${unknown} param, passes the computed unknown key list into createError, and adjusts the noUnknown test to surface those keys; tests now assert the error string includes the extra field name.

Written by Cursor Bugbot for commit 49ec7b5. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread src/object.js
exclusive: true,
message: message,
test(value) {
const unknownKeys = unknown(this.schema, value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null value crashes due to eager unknown() call

High Severity

The unknown() function call was moved outside the short-circuit || chain, so it now executes unconditionally — even when value is null or undefined. The unknown function calls Object.keys(value), which throws a TypeError for null/undefined values. Previously, the short-circuit evaluation of value == null || guaranteed unknown() was only reached for non-null values.

Fix in Cursor Fix in Web

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