Interview Prep/GitHub Actions/Expressions, Outputs, Matrix & Conditions

`Error reading JToken from JsonReader. Path '', line 0, position 0.`

AdvancedTroubleshootingExpressions, Outputs, Matrix & Conditions
Answer

Likely causes → fromJSON(''): the output feeding fromJSON is empty because the upstream job or step was skipped, failed or the output name is wrong.

Diagnose → Check upstream job status and whether the output is set.

Fix → Fix the output; guard with if on non-empty; or provide a default: fromJSON(needs.plan.outputs.matrix || '{"include":[]}'), plus an empty-matrix guard.

Prevent → Validate JSON in the producing step with jq -e ..

All GitHub Actions questions Roadmap: GitHub Actions

More on Expressions, Outputs, Matrix & Conditions