Turborepo: run failed: turbo.json: json: cannot unmarshal array into Go struct field — or how you should always add your json schema

This one was tough to debug. I upgraded turbo to the latest, and also added new “globalDependencies” which controls the cache hash for all pipelines.

The problem was that I had placed “globalDependencies” inside of the “pipeline” on accident, and somehow just missed it. A better error would have helped, because the error is so generic people have this error everywhere. Low signal to noise ratio.

I adopted Turborepo super early so a lot of setup is old. I added the JSON schema:

{"$schema": "https://turbo.build/schema.json"} which the linter immediately called out that values in the pipeline object should be objects, which finally brought my attention to the fact globalDependencies was not at the root.

Lesson of the day? Add your schema, get some free lint.

{
    "$schema": "https://turbo.build/schema.json",
    "pipeline": {
        "myMistake": ["..."]
    }
}

Leave a Comment