Description
sentry event view silently produces zero output and exits with code 0 when given a single slash-separated argument like sentry/cli/abc123def. The user likely intended sentry event view sentry/cli abc123def (space-separated), but there's no error, no output, and no hint about the correct format.
Steps to Reproduce
sentry event view sentry/cli/abc123def456
echo $? # prints 0
Actual behavior:
- stdout: empty
- stderr: empty
- exit code: 0
Expected behavior:
- Should exit with code 1 and print an error message like:
Error: Invalid event ID "sentry/cli/abc123def456" (contains "/")
Usage: sentry event view <org>/<project> <event-id>
Root Cause
The bug is in src/commands/event/view.ts:85-128 (parsePositionalArgs):
sentry event view sentry/cli/abc123def provides a single positional arg: "sentry/cli/abc123def"
parsePositionalArgs sees args.length === 1 (line 115) and returns { eventId: "sentry/cli/abc123def", targetArg: undefined }
- The entire string becomes the "event ID", and
targetArg is undefined
parseOrgProjectArg(undefined) returns AutoDetect (line 172-174 of arg-parsing.ts)
- Auto-detection resolves an org/project from DSN or config defaults
getEvent(org, project, "sentry/cli/abc123def") is called with the full string as the event ID
- The API returns a 404 or empty response, but the error is swallowed — the command exits cleanly
The lack of any output or error makes this particularly confusing for users.
Proposed Fix
Validate the event ID format in parsePositionalArgs before returning. Event IDs are 32-character hex strings — a value containing / is almost certainly a misformatted argument:
// After determining eventId (before the return statements):
if (eventId.includes("/")) {
throw new ContextError(
"Event ID (got a slash — did you mean two separate arguments?)",
USAGE_HINT
);
}
Additionally, the getEvent API call path should be investigated to understand why the 404 is being swallowed instead of propagating as an ApiError.
Files
src/commands/event/view.ts:85-128 — parsePositionalArgs function
src/commands/event/view.ts:177-269 — viewCommand.func (the command handler)
src/lib/arg-parsing.ts:171-220 — parseOrgProjectArg function
Description
sentry event viewsilently produces zero output and exits with code 0 when given a single slash-separated argument likesentry/cli/abc123def. The user likely intendedsentry event view sentry/cli abc123def(space-separated), but there's no error, no output, and no hint about the correct format.Steps to Reproduce
Actual behavior:
Expected behavior:
Root Cause
The bug is in
src/commands/event/view.ts:85-128(parsePositionalArgs):sentry event view sentry/cli/abc123defprovides a single positional arg:"sentry/cli/abc123def"parsePositionalArgsseesargs.length === 1(line 115) and returns{ eventId: "sentry/cli/abc123def", targetArg: undefined }targetArgisundefinedparseOrgProjectArg(undefined)returnsAutoDetect(line 172-174 ofarg-parsing.ts)getEvent(org, project, "sentry/cli/abc123def")is called with the full string as the event IDThe lack of any output or error makes this particularly confusing for users.
Proposed Fix
Validate the event ID format in
parsePositionalArgsbefore returning. Event IDs are 32-character hex strings — a value containing/is almost certainly a misformatted argument:Additionally, the
getEventAPI call path should be investigated to understand why the 404 is being swallowed instead of propagating as anApiError.Files
src/commands/event/view.ts:85-128—parsePositionalArgsfunctionsrc/commands/event/view.ts:177-269—viewCommand.func(the command handler)src/lib/arg-parsing.ts:171-220—parseOrgProjectArgfunction