Hide
Google BigQuery

Troubleshooting Errors

You'll encounter two types of errors when working with BigQuery: HTTP error codes or job errors. Job errors are represented in the status object when calling jobs.get().

Contents

Error table

The following table lists possible error codes that return when making a request to the BigQuery API. API responses include an HTTP error code and an errors object. The "Error code" column below maps to the reason property in the error object.

If you use the bq command-line tool to check job status, the error object is not returned by default. To view the object and the corresponding reason property that maps to the below table, use the --format=prettyjson flag. For example, bq --format=prettyjson show -j <job id>

If you receive an HTTP response code that doesn't appear in the list below, the response code indicates an issue or an expected result with the HTTP request. For example, a 502 error indicates there is an issue with your network connection. For a full list of HTTP response codes, see HTTP response codes.

Error code HTTP code Description Troubleshooting
accessDenied 403 This error returns when you try to access a resource, such as a table, dataset or job, that you don't have access to. This error also returns when you try to modify a read-only object. Contact the resource owner and ask for access to the resource.
backendError 503

This error returns when there is a temporary server failure such as a network connection problem or a server overload.

In general, wait a few seconds and try again. However, there are two special cases for troubleshooting this error: jobs.get() calls and jobs.insert() calls.

jobs.get() calls

  • If you received a 503 error when polling jobs.get(), wait a few seconds and poll again.
  • If the job completes but includes an error object that contains backendError, the job failed. You can safely retry the job without concerns about data consistency.

jobs.insert() calls

If you receive this error when making a jobs.insert() call, it's unclear if the job succeeded or not. In this situation, you'll need to retry the job. See data consistency for tips on how to avoid duplication when retrying jobs.

billingNotEnabled 403

This error returns when billing isn't enabled for the project.

Enable billing for the project in the Google Developers Console.

blocked 403 This error returns when BigQuery has temporarily blacklisted the operation you attempted to perform, usually to prevent a service outage. This error rarely occurs. Contact support for more information.
duplicate 409 This error returns when trying to create a job, dataset or table that already exists. The error also returns when a job's writeDisposition property is set to WRITE_EMPTY and the destination table accessed by the job already exists. Rename the resource you're trying to create, or change the writeDisposition value in the job.
internalError 500 This error returns when an internal error occurs within BigQuery. Contact support or file a bug.
invalid 403 This error returns when there is any kind of invalid input other than an invalid query, such as missing required fields or an invalid table schema. Invalid queries return an invalidQuery error instead.
invalidQuery 400 This error returns when you attempt to run an invalid query. Fix the query. The query reference contains descriptions and examples of how to construct valid queries.
notFound 404 This error returns when you refer to a resource (a dataset, a table, or a job) that doesn't exist. Fix the resource names.
notImplemented 501 This job error returns when you try to access a feature that isn't implemented. Contact support for more information.
quotaExceeded 403 This error returns when your project exceeds a BigQuery quota, or when you haven't set up billing and exceed the free tier for queries. View the message property of the error object for more information about which quota was exceeded.
rateLimitExceeded 403

This error returns if your project exceeds the concurrent rate limit or the API requests limit by sending too many requests too quickly.

Slow down the request rate.

If you believe that your project did not exceed one of these limits, please contact support.

resourceInUse 400 This error returns when you try to delete a dataset that contains tables or when you try to delete a job that is currently running. Empty the dataset before attempting to delete it, or wait for a job to complete before deleting it.
resourcesExceeded 400 This error returns when your query uses too many resources.
  • Try breaking up the query into smaller pieces.
  • Try removing an ORDER BY clause.
  • Use GROUP EACH BY or JOIN EACH instead of GROUP BY or JOIN. For more information see GROUP BY clause and JOIN clause.
  • If your query uses JOIN EACH, ensure that the larger table is on the left-hand side of the clause.
  • If your query uses FLATTEN, determine if it's necessary for your use case. For more information, see nested and repeated data.
  • If your query uses COUNT(DISTINCT <value>, <n>) with a large <n> value, consider using GROUP EACH BY instead. For more information, see COUNT(DISTINCT).
responseTooLarge 403 This error returns when your query's results are larger than the maximum response size. Some queries execute in multiple stages, and this error returns when any stage returns a response size that is too large, even if the final result is smaller than the maximum. This error commonly returns when queries use an ORDER BY clause. Adding a LIMIT clause can sometimes help, or removing the ORDER BY clause. If you want to ensure that large results can return, you can set the allowLargeResults property to true and specify a destination table.

Sample error response

GET https://www.googleapis.com/bigquery/v2/projects/12345/datasets/foo
Response:
[404]
{
  "error": {
  "errors": [
  {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found: Dataset myproject:foo"
  }],
  "code": 404,
  "message": "Not Found: Dataset myproject:foo"
  }
}

Authentication errors

Errors thrown by the OAuth token generation system return the following JSON object, as defined by the OAuth2 specification.

{"error" : "description_string"}

The error is accompanied by either an HTTP 400 Bad Request error or an HTTP 401 Unauthorized error. description_string is one of the error codes defined by the OAuth2 specification. For example:

{"error":"invalid_client"}

Back to top