Troubleshooting

You'll encounter two types of errors when working with BigQuery:

  • HTTP error codes
  • Job errors are represented in thestatusobject when calling jobs.get().

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 thereasonproperty 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 correspondingreasonproperty that maps to the below table, use the--format=prettyjsonflag. For example,bq --format=prettyjson show -j<job id>

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 500 or 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 andjobs.insert()calls. jobs.get() calls If you received a 503 error when pollingjobs.get(), wait a few seconds and poll again. If the job completes but includes an error object that containsbackendError, the job failed. You can safely retry the job without concerns about data consistency. jobs.insert() callsIf you receive this error when making ajobs.insert()call, it's unclear if the job succeeded or not. In this situation, you'll need to retry the job.
billingNotEnabled 403 This error returns when billing isn't enabled for the project. Enable billing for the project in theGoogle Cloud Platform Console.
billingTierLimitExceeded 400 This error returns when you try to execute a high-compute query that exceeds your project's maximum billing tier. Reduce the number of calculations done per input byte or enablehigh-compute queriesto allow more calculations per byte.
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.
duplicate 409 This error returns when trying to create a job, dataset or table that already exists. The error also returns when a job'swriteDispositionproperty is set toWRITE_EMPTYand the destination table accessed by the job already exists. Rename the resource you're trying to create, or change thewriteDispositionvalue in the job.
internalError 500 This error returns when an internal error occurs within BigQuery.
invalid 400 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 aninvalidQueryerror instead.
invalidQuery 400 This error returns when you attempt to run an invalid query. Double check your query for syntax errors. 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 supportfor more information.
quotaExceeded 403 This error returns when your project exceeds a BigQuery quota, a custom quota, or when you haven't set up billing and exceed the free tier for queries. View themessageproperty of the error object for more information about which quota was exceeded. To reset or raise a BigQuery quota, contact support. To modify a custom quota, submit the Custom Quota Request form.
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 anORDER BYclause.If your query usesJOIN, ensure that the larger table is on the left-hand side of the clause.If your query usesFLATTEN, determine if it's necessary for your use case. For more information, see nested and repeated data. If your query usesEXACT_COUNT_DISTINCT, consider using COUNT(DISTINCT) instead.If your query usesCOUNT(DISTINCT<value>,<n>)with a large_<n>_value, consider usingGROUP BYinstead. For more information, see COUNT(DISTINCT). If your query usesUNIQUE, consider usingGROUP BYinstead, or awindow function inside of a subselect.
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 anORDER BYclause. Adding aLIMITclause can sometimes help, or removing theORDER BYclause. If you want to ensure that large results can return, you can set theallowLargeResultsproperty totrueand specify a destination table.
stopped 200 This status code returns when a job is canceled.
tableUnavailable 400 Certain BigQuery tables are backed by data managed by other Google product teams. This error indicates that one of these tables is unavailable. When you encounter this error message, you can retry your request (see internalErrortroubleshooting suggestions) or contact the Google product team that granted you access to their data.

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 theOAuth2 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"}

Troubleshooting streaming inserts

The following sections discuss how to troubleshoot errors that occur when you stream data into BigQuery.

Failure HTTP response codes

If you receive a failure HTTP response code such as a network error, there's no way to tell if the streaming insert succeeded. If you try to simply re-send the request, you might end up with duplicated rows in your table. To help protect your table against duplication, set theinsertIdproperty when sending your request. BigQuery uses theinsertIdproperty for de-duplication.

If you receive a permission error, an invalid table name error or an exceeded quota error, no rows are inserted and the entire request fails.

Success HTTP response codes

Even if you receive a success HTTP response code, you'll need to check theinsertErrorsproperty of the response to determine if the row insertions were successful, because it's possible that BigQuery was only partially successful at inserting the rows.

If theinsertErrorsproperty is an empty list, all of the rows inserted successfully. Otherwise, except in cases where there was a schema mismatch in any of the rows, rows indicated in theinsertErrorsproperty were not inserted, and all other rows were inserted successfully. Theerrorsproperty contains detailed information about why each unsuccessful row failed. Theindexproperty indicates the 0-based row index of the request that the error applies to.

If BigQuery encounters a schema mismatch on individual rows in the request, none of the rows are inserted and aninsertErrorsentry is returned for each row, even the rows that did not have a schema mismatch. Rows that did not have a schema mismatch will have an error with thereasonproperty set tostopped, and can be re-sent as-is. Rows that failed include detailed information about the schema mismatch.

results matching ""

    No results matching ""