Error on cloudbuild.yaml : (gcloud.builds.submit) interpreting cloudbuild.yaml as build config: ‘list’ object has no attribute ‘items’

This is my cloudbuild.yaml file:

steps:
  # BUILD IMAGE
  - name: "gcr.io/cloud-builders/docker"
    args:
      - "build"
      - "--build-arg"
      - "PROJECT_ID=$PROJECT_ID"
      - "--build-arg" 
      - "SERVER_ENV=$_SERVER_ENV"
      - "--tag"
      - "gcr.io/$PROJECT_ID/my-image:$TAG_NAME"
      - "."
    env:
      - "PROJECT_ID=$PROJECT_ID"
    timeout: 180s
  # PUSH IMAGE TO REGISTRY
  - name: "gcr.io/cloud-builders/docker"
    args:
      - "push"
      - "gcr.io/$PROJECT_ID/my-image:$TAG_NAME"
    timeout: 180s
  # DEPLOY CONTAINER WITH GCLOUD
  - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
    entrypoint: gcloud
    args:
      - "run"
      - "deploy"
      - "my-service"
      - "--image=gcr.io/$PROJECT_ID/my-image:$TAG_NAME"
      - "--platform=managed"
      - "--region=us-central1"
      - "--min-instances=1"
      - "--max-instances=3"
      - "--port=8080"
    timeout: 180s

images: 
  - "gcr.io/$PROJECT_ID/my-image:$TAG_NAME"
substitutions: 
  - "_SERVER_ENV=TEST"

Is there anything wrong with this file?

Here is the error I’m getting when I’m running the following command:

gcloud builds submit ./cloudRun                   
--config=./cloudRun/cloudbuild.yaml               
--substitutions=_SERVER_ENV=TEST,TAG_NAME=MY_TAG  
--project=MY_PROJECT_ID

ERROR: (gcloud.builds.submit) interpreting ./cloudRun/cloudbuild.yaml as build config: ‘list’ object has no attribute ‘items’

Source: Docker Questions