Search code examples
google-cloud-platformgoogle-cloud-automl

Required field is invalid error when trying to create new dataset in GCP AutoML object detection


I am following the quickstart for AutoML object detection. Unfortunately I run into an error I cannot figure out. At the very first curl command

curl -X POST \
           -H "Authorization: Bearer $TOKEN" \
           -H "Content-Type: application/json" \
           "https://automl.googleapis.com/v1beta1/projects/$PROJECT_ID/locations/us-central1/datasets" -d '{
               "display_name": "dataset_name",
               "image_object_detection_dataset_metadata": {
               }
           }'

I get this error:

{
  "error": {
    "code": 400,
    "message": "List of found errors:\t1.Field: parent; Message: Required field is invalid\t",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "parent",
            "description": "Required field is invalid"
          }
        ]
      }
    ]
  }
}

It seems to be some kind of schema validation error, so perhaps they changed the request body format but I cannot figure out how to change it.


Solution

  • Doh, It turns out the PROJECT_ID variable was not actually set.

    It's somewhat typical of GCP that you get very cryptic errors sometimes when working through their APIs.