Skip to content

fix(cli): Show the server's hint for rejected Explore function arguments - #1966

Merged
BYK merged 1 commit into
mainfrom
fix/cli-explore-server-hint
Nov 4, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/cli-explore-server-hint

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1927 (CLI-10), as decided in this review thread.

The invalid_function_argument 400 can now carry a hint (getsentry/sentry#129981). readErrorFields reads it next to function and argument, and sentry explore shows it as the suggestion. The CLI's own transaction.duration → span.duration mapping is gone, since the server owns that text now. The tags[X,number] / sentry attribute list hint names CLI commands and flags, so it stays in the CLI as the fallback when there's no hint.

Until sentry#129981 deploys, transaction.duration gets the generic fallback hint instead of the span.duration one.

Before

$ sentry explore my-org/ --dataset transactions -F 'sum(transaction.duration)'
Error: Sentry rejected --field "sum(transaction.duration)" for dataset "spans".

transaction.duration is invalid for parameter 1 in sum. Its a string type field, but it must be one of these types: {'number', 'duration'}

Try:
  Use span.duration instead of transaction.duration. Transactions are queried as spans, which store their duration in span.duration.

After

With the server's hint:

$ sentry explore my-org/ --dataset transactions -F 'sum(transaction.duration)'
Error: Sentry rejected --field "sum(transaction.duration)" for dataset "spans".

transaction.duration is invalid for parameter 1 in sum. Its a string type field, but it must be one of these types: {'number', 'duration'}

Try:
  Use span.duration instead of transaction.duration on the spans dataset.

Without it (before sentry#129981 deploys):

Try:
  sum() does not accept transaction.duration on dataset "spans": it may not exist there, or may not have the type sum() needs. Reference a numeric custom attribute with its type, e.g. tags[transaction.duration,number]; to check the key and its type, run: sentry attribute list <org>/ transaction.duration --dataset spans

via @BYK.

--

View Session [Sentry]

Read the optional `hint` the server sends with invalid_function_argument
400s (getsentry/sentry#129981) and show it as the suggestion. Drop the
CLI's own transaction.duration -> span.duration mapping, which the server
now owns. The tags[name,number] / sentry attribute list hint stays as the
fallback when the server sends no hint.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 4, 2026 10:24pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 4, 2026
@BYK
BYK enabled auto-merge (squash) November 4, 2026 22:27
@BYK
BYK merged commit 3306eb4 into main Nov 4, 2026
27 checks passed
@BYK
BYK deleted the fix/cli-explore-server-hint branch November 4, 2026 22:34

This branch was previously deployed

1 inactive deployment
Preview — 183db543 Deployed Nov 4, 2026 by vercel[bot]
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.

1 participant