feat(snuba): handle TOO_MANY_BYTES as clickhouse error instead of 429#109747
Open
feat(snuba): handle TOO_MANY_BYTES as clickhouse error instead of 429#109747
Conversation
…e limit Add QueryBytesScannedExceeded exception for ClickHouse error code 307 (TOO_MANY_BYTES). This is raised when a query exceeds the max_bytes_to_read limit set by an allocation policy, distinct from Snuba-level rate limiting. - Add QueryBytesScannedExceeded to clickhouse_error_codes_map (code 307) - Handle it explicitly in handle_query_errors() before the generic QueryExecutionError catch, returning a descriptive error message Co-authored-by: Claude <noreply@anthropic.com>
kylemumma
reviewed
Mar 12, 2026
Member
kylemumma
left a comment
There was a problem hiding this comment.
Could you explain how this is different from snuba allocation policy? Allocation policy exceeded seems like a 4xx error not a 5xx
Contributor
Author
@onewland has more context, this is in conjunction with getsentry/snuba#7782 such that if a user runs a query that will always exceed their bytes scanned allocation policy, they get a 400 rather than a 429. not sure if we want to continue this direction though |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add QueryBytesScannedExceeded exception for ClickHouse error code 307 (TOO_MANY_BYTES). This is raised when a query exceeds the max_bytes_to_read limit set by an allocation policy.