Error when running DataFlow from Commandline - "type.googleapis.com/google.rpc.PreconditionFailure"

I’m getting the below Error when running DataFlow from Commandline - I would like to know what is wrong in this command and how to run Dataflow successfully using “gcloud dataflow jobs run” command? I don’t find these options covered in detail in GCP Documentation.

Below is the template that I’m using in --gcs-location
https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v1/src/main/java/com/google/cloud/teleport/templates/WordCount.java

Below is the command and Error,

rajkumar@cloudshell:~ (raj-box)$ gcloud dataflow jobs run WordCountDemocli --project raj-box --gcs-location “gs://raj/Default Templates/WordCount.java” --region asia-south1 --num-workers 2 --staging-location gs://raj/temp --subnetwork https://www.googleapis.com/compute/v1/projects/raj-box/regions/asia-south1/subnetworks/default --disable-public-ips --parameters inputLocations=“{“location1”:“gs://dataflow-samples/shakespeare/kinglear.txt”}”,outputLocations=“{“location1”:“gs://raj/wordcountoutput/wordcount”}”

ERROR: (gcloud.dataflow.jobs.run) FAILED_PRECONDITION: Unable to parse template file ‘gs://raj/Default Templates/WordCount.java’.
- ‘@type’: type.googleapis.com/google.rpc.PreconditionFailure
violations:
- description: “Unexpected end of stream : expected ‘{’”
subject: 0:0
type: JSON
rajkumar@cloudshell:~ (raj-box)$

Hi @rajkumarjai1 ,

It’s been some time, so unsure if you’re still experiencing an issue, however I have some ideas. The error message indicates that the template file is not valid JSON. You can verify this by trying to parse the file with a JSON parser, such as JSONLint or JSON.org.

If the file is not valid JSON, you can try to fix the errors and then run the command again. If you are still having trouble, you can contact Google Cloud Platform support for assistance.

Here are some common causes of JSON validation errors:

  • Missing a comma or curly brace.
  • Incorrect syntax.
  • Unexpected characters.

To fix these errors, you can use a JSON editor to visually identify the errors and then make the necessary corrections.

Here are some tips for using JSON:

  • Use a JSON editor to visually identify and fix errors.
  • Use a JSON parser to validate your JSON files.
  • Use JSONLint or JSON.org to validate your JSON files.
  • Use Google Cloud Platform support for assistance