Skip to content

fix(tools): Name the fix in model-facing tool error messages - #4058

Merged
dcramer merged 1 commit into
mainfrom
fix/tool-error-fix-hints
Nov 22, 2026
Merged

dcramer merged 1 commit into
mainfrom
fix/tool-error-fix-hints

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Applies the tool error rule from the design docs in #4050: an error that the model can fix says what was wrong and how to fix it. That means the argument and the form that it takes, the tool that finds the right value, or that no change to the call can work in this Turn.

Many ToolInputError / PluginToolInputError messages only said what failed, such as "Automation was not found.", "edits is required", or "Attachment not found in this conversation." The model then guessed, retried the same call, or gave up. This PR adds the missing fix to those messages in core and in the GitHub, Google, and Vercel plugins. Messages that already named a fix stay as they are.

Examples:

  • Automation was not found. → Automation was not found. Use searchAutomations to find its id. …
  • edits is required → edits is required. Set edits to a list of { old_text, new_text } replacements.
  • Slack workspace is unavailable. → The Slack workspace of this Conversation is unknown. Set destination to "current_conversation", or ask from the Slack channel where the automation should deliver.
  • ttl_ms must be a positive finite number → ttl_ms must be a positive number of milliseconds. Leave it out to use the default.
  • GitHub 404/422 failures now add Check repo and issue, and fix any field that GitHub names., with the fields of that tool.

Each tool or field that a message names exists in the context where the error is thrown. Where the runtime or a person has to act, such as a missing Turn or tool call id, an unlinked User, or a missing Slack scope, the message says that no change to the call can fix it.

A few upstream message sources that reach the model through these throw sites got the same treatment: the Slack channel-access denials, the ScheduleIntentError messages, and the public-search scope errors. In event-automations/tool-support.ts, a message that named resourceType now uses the schema field resource_type.

Error classes, control flow, schemas, plain Error throws, and the tool-error-classification baseline are unchanged. Tests that asserted the exact old strings are updated.

via @dcramer.

--

View Session [Sentry]

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 22, 2026 10:41pm UTC

Request Review

@dcramer
dcramer marked this pull request as ready for review November 22, 2026 22:54
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 22, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 418ceee. Configure here.

throw new PluginToolInputError(`${name} is required`);
throw new PluginToolInputError(
`${name} must not be empty. Set it and call the tool again.`,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Runtime fields get retry advice

Medium Severity

nonEmptyString now tells the model to set the empty field and retry, but it also validates runtime conversationId and toolCallId. Those values come from the Turn, not the tool arguments, so the new fix sends the model to retry a call it cannot repair.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 418ceee. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. One nonEmptyString helper checks both model fields (title, head, base, labels) and the runtime conversationId and toolCallId, so the retry advice is wrong for the runtime ids. This PR merged before I could change it. The fix belongs in a follow-up: give the runtime ids their own check with a "no change to the call can fix this" message, in both create-issue.ts and create-pull-request.ts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#4060 fixes this. In createIssue and createPullRequest, conversationId and toolCallId now get their own check, with a "no change to the call can fix this" message.

if (!response.ok) {
throw new PluginToolInputError(
`GitHub repository lookup failed with HTTP ${response.status}`,
`GitHub repository lookup failed with HTTP ${response.status}. Check repo. If it is correct, the GitHub App cannot see the repository.`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Repo lookup blames visibility always

Low Severity

getRepository now appends “Check repo. If it is correct, the GitHub App cannot see the repository.” to every non-OK response. getIssue and getPullRequest only add that text on HTTP 404, so 401/5xx lookups are described as a visibility miss when they are not.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 418ceee. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. getRepository throws the repairable error for every non-OK status, and it now adds the visibility hint to all of them. The hint is right only for 404. This PR merged before I could change it. A follow-up should add the hint only on 404, as getIssue and getPullRequest do, and treat other statuses as system errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#4060 fixes this. getRepository now adds the visibility hint only on 404. Other statuses throw a system error, as in getIssue and getPullRequest.

@dcramer
dcramer merged commit 45b5e68 into main Nov 22, 2026
62 checks passed
@dcramer
dcramer deleted the fix/tool-error-fix-hints branch November 22, 2026 22:57

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 418ceeee Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant