Skip to content

fix(span): Use ResolutionError for missing spans#1236

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/span-resolution-error
Open

fix(span): Use ResolutionError for missing spans#1236
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/span-resolution-error

Conversation

@sentry

@sentry sentry Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Previously, when a requested span ID could not be found within a given trace, the CLI would throw a ValidationError.

This commit corrects the error type to ResolutionError in src/commands/span/view.ts.

ValidationError is intended for invalid user input, whereas a missing resource (like a span not found in a valid trace) is a resolution failure, which ResolutionError is designed to represent, aligning with CLI error categorization guidelines.

Fixes CLI-1Q4

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1236/

Built to branch gh-pages at 2026-07-14 10:40 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

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 cef347d. Configure here.

Comment thread src/commands/span/view.ts
if (results.length === 0) {
const idList = formatIdList(spanIds);
throw new ValidationError(
throw new ResolutionError(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wrong ResolutionError constructor call

High Severity

ResolutionError expects separate resource, headline, and hint arguments, but this call passes a single message string as if it were ValidationError. At runtime that yields a broken message with undefined for the headline and hint, so the missing-span error path the PR aims to fix does not produce a usable resolution error.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cef347d. Configure here.

Comment thread src/commands/span/view.ts
Comment on lines +416 to 419
throw new ResolutionError(
spanIds.length === 1
? `No span found with ID "${spanIds[0]}" in trace ${traceId}.`
: `No spans found with any of the following IDs in trace ${traceId}:\n${idList}`

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.

Bug: The ResolutionError constructor is called with only one argument instead of the required three, which will result in a garbled error message containing the literal string "undefined".
Severity: MEDIUM

Suggested Fix

Refactor the ResolutionError call to provide the three required arguments: resource, headline, and hint. The existing message string should be broken down and passed as separate arguments to the constructor to ensure the error message is formatted correctly.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/commands/span/view.ts#L416-L419

Potential issue: The `ResolutionError` constructor is being called with a single string
argument, but its signature requires three mandatory arguments: `resource`, `headline`,
and `hint`. Because only one argument is provided, the `headline` and `hint` parameters
will be `undefined`. When the error message is constructed, it will include the literal
string "undefined", resulting in a garbled and unhelpful message for the user, such as
`"No span found... undefined.\n\nTry:\n  undefined"`.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants