瞭解如何解決 Vertex AI Vision 發生的一些錯誤。本主題討論的錯誤解決方案需要較多步驟,無法在錯誤訊息中簡易描述。
如需錯誤處理的建議做法,請參閱 Cloud API 說明文件。
權限
無法使用應用程式預設憑證
如果您收到以下這則訊息:
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.
權限遭拒
如果您收到以下這則訊息:
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" } }
確認您存在 GOOGLE_APPLICATION_CREDENTIALS
環境變數中的位置具有有效的服務帳戶金鑰 JSON 檔案,且該變數指向正確的地方。
如要診斷此錯誤,請嘗試從您想呼叫 Vertex AI Vision API 的資料夾開啟服務帳戶金鑰檔案。
cat $GOOGLE_APPLICATION_CREDENTIALS
禁止:403 POST API 未使用或已停用
如果收到以下訊息:
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.
- 請前往錯誤訊息中指定的連結,啟用 Vertex AI Vision API。請稍候幾分鐘,然後再試一次。
- 確認您在
GOOGLE_APPLICATION_CREDENTIALS
環境變數中儲存了有效的服務帳戶金鑰 JSON 檔案。如要診斷此錯誤,請嘗試從您想呼叫 Vertex AI Vision API 的資料夾開啟服務帳戶金鑰檔案。cat $GOOGLE_APPLICATION_CREDENTIALS
引數無效
不支援的 API 版本
示例:向不支援該作業的 API 版本提出要求。
message: "The requested operation is unsupported for the API version."
Bad Request (錯誤的要求)
提出 API 要求時,要求欄位含有一或多項違規事項。每項違規都會在 google.rpc.BadRequest
詳細資料中以 field_violations
的形式記錄。
message: "Request contains an invalid argument."
details {
[type.googleapis.com/google.rpc.BadRequest] {
field_violations { field: "foo" description: "bar" }
}
}
專案編號無效
當您提供無效的專案編號時,範例專案編號:848757893952147483648。
message: "Invalid project number used: 848757893952147483648."
details {
[type.googleapis.com/google.rpc.ErrorInfo] {
reason: "INVALID_PROJECT_NUMBER"
domain: "visionai.googleapis.com"
}
}
資源格式無效
資源格式無效時,範例專案編號:1234,範例位置 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"
}
}
不符先決條件
缺少影片資料
某些 API (例如用於區隔層註解的 CreateAnnotation) 需要素材資源已流入影片資料,才能推斷素材資源的開始時間。否則會觸發下列錯誤。
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"
}
}
配額與限制
超過配額
如果您收到以下這則訊息:
RESOURCE_EXHAUSTED: Quota exceeded.
您已達到每分鐘或每日配額的上限。請查看使用 Vertex AI Vision 的配額與限制。
您可以透過 Google Cloud 控制台要求增加配額。