Skip to content

Should a rateLimitExceeded have a "429 Too Many Requests" instead of "403 Forbidden"?  #2006

@cozos

Description

@cozos

In many cases, users want to be able to retry rateLimitExceeded errors. Many retry libraries and codebases support this by automatically retrying HTTP exceptions with a 429 Too Many Requests HTTP error, and any 5XX error codes. For example, BigQuery itself. However BigQuery will raise a 403 Forbidden for rate limit problems - see:

"rateLimitExceeded": http.client.FORBIDDEN,

A 403 Forbidden implies that the API user does not have the permissions or authentication credentials to do the thing. That seems inappropriate for a rateLimitError, right?

This mis-coding has two consequences for retry logic:

  • In codebases where you'd expect to get retries for free, you don't, because libraries won't retry a 403 Forbidden, and rightly so - why would you retry an access error.
  • Users who do want to implement retries for BQ rateLimitExceeded errors now have to retry on 403 Forbidden, possibly causing them to retry genuine permissions/auth errors that will fail no matter how many attempts.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions