Error messages

Learn how to resolve some errors raised by Vertex AI Vision. This topic discusses errors whose resolutions require more steps than can be easily described in an error message.

See the Cloud API documentation for recommended practices of error handling.

Permissions

Application default credentials are not available

If you receive this message:

The Application Default Credentials are not available. They are
available if running in Google Compute Engine. Otherwise, the
environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined
pointing to a file defining the credentials.
See https://developers.google.com/accounts/docs/application-default-credentials
for more information.

Permission denied

If you receive this message:

ERROR: (gcloud.auth.application-default.print-access-token) File /path/to/key.json
(pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not exist!
{
  "error": {
    "code": 403,
    "message": "The request is missing a valid API key.",
    "status": "PERMISSION_DENIED"
  }
}

Verify that you have a valid service account key JSON file in the location stored in the GOOGLE_APPLICATION_CREDENTIALS environment variable and that the variable points to the correct place.

To diagnose this error, try opening the service account key file from the folder from which you're attempting to call the Vertex AI Vision API.

cat $GOOGLE_APPLICATION_CREDENTIALS

Forbidden: 403 POST API has not been used or is disabled

If you receive the message:

Forbidden: 403 POST Vertex AI Vision API has not been used in
project # before or it is disabled.
Enable it by visitng [url] then retry.
If you enabled this API recently, wait a few minutes for the action to
propagate and retry.

  1. Visit the link specified in the error message and enable the Vertex AI Vision API. Wait several minutes and then retry.
  2. Verify that you have a valid service account key JSON file stored in the GOOGLE_APPLICATION_CREDENTIALS environment variable. To diagnose this error, try opening the service account key file from the folder from which you're attempting to call the Vertex AI Vision API.
    cat $GOOGLE_APPLICATION_CREDENTIALS
    

Invalid arguments

API version unsupported

Example: when a request is made to an API version which does not support the operation.

message: "The requested operation is unsupported for the API version."

Bad Request

When an API request is made but the request fields have one or more violations. Each violation is captured as a field_violations in the google.rpc.BadRequest details.

message: "Request contains an invalid argument."
details {
  [type.googleapis.com/google.rpc.BadRequest] {
    field_violations { field: "foo" description: "bar" }
  }
}

Invalid Project Number

When an invalid project number is provided. Example project number: 848757893952147483648.

message: "Invalid project number used: 848757893952147483648."
details {
    [type.googleapis.com/google.rpc.ErrorInfo] {
      reason: "INVALID_PROJECT_NUMBER"
      domain: "visionai.googleapis.com"
    }
}

Invalid Resource Format

When a resource format is invalid. Example project number: 1234 and Example location ID: us-central1.

message: "Invalid Resource Used: project/1234/location/us-central1. Valid format should be "
"projects/{project_number}/locations/{location_id}."
details {
    [type.googleapis.com/google.rpc.ErrorInfo] {
      reason: "INVALID_RESOURCE_FORMAT"
      domain: "visionai.googleapis.com"
    }
}

Failed Precondition

Missing Video Data

Some APIs (such as CreateAnnotation for a partition level annotation), it is required for the asset to already have video data streamed in to infer the asset's start time. Otherwise the following error will be triggered.

message: "Asset doesn't have start time inferred yet. Should ingest asset and retry."
details {
    [type.googleapis.com/google.rpc.ErrorInfo] {
      reason: "FAILED_PRECONDITION"
      domain: "visionai.googleapis.com"
    }
}

Quotas and limits

Quota exceeded

If you receive this message:

RESOURCE_EXHAUSTED: Quota exceeded.

You have reached the limit of your per-minute or daily quota. Review the quotas & limits for using Vertex AI Vision.

You can request an increase to your quotas from the Google Cloud console.