Skip to content

fix(api-client): Prevent ZodError on Sentry API 400 in validateEvents#1160

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-validate-events-400-error
Open

fix(api-client): Prevent ZodError on Sentry API 400 in validateEvents#1160
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-validate-events-400-error

Conversation

@sentry

@sentry sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

This PR addresses issue MCP-SERVER-G3K, where SentryApiService.validateEvents was throwing a ZodError when the Sentry API returned a 400 Bad Request.

The root cause was that allowStatuses: [400] was explicitly passed to this.request, which prevented the 400 HTTP response from being thrown as an ApiError. Instead, the error payload (e.g., {"detail": "..."}) was returned as a successful response body and then passed to EventsValidationResponseSchema.parse, leading to a Zod validation failure.

The fix involves removing allowStatuses: [400] from the this.request call within validateEvents. This ensures that 400 Bad Request responses from the Sentry API are correctly handled as errors, throwing an ApiError as expected, and preventing the malformed payload from reaching the Zod schema parser.

Fixes MCP-SERVER-G3K

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

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.

0 participants