# GitHub Actions: Matrix vector 'node' does not contain any values / Error when evaluating 'strategy' for job

**Code:** `Matrix vector does not contain any values` · **Category:** CI/CD · **Seen on:** GitHub Actions

The job's `strategy.matrix` ended up empty — a `fromJSON()` expression produced no values, or a dimension is an empty list.

## Meaning

Dynamic matrices built from another job's output fail when that output is empty, malformed, or the producing job was skipped. A static dimension with no items fails the same way. Validate the JSON, skip the matrix job with an `if:` when the list is empty, and print the output for debugging.

## Common causes

- `fromJSON(needs.setup.outputs.matrix)` with an empty or missing output
- Producer job skipped or failed so no output exists
- Invalid JSON (single quotes, trailing comma)
- Empty array for a matrix dimension
- Wrong output name between jobs

## Quick fix

1. Echo the producing job's output and validate with `jq`
2. Guard the matrix job: `if: needs.setup.outputs.matrix != '[]'`
3. Use `include` with explicit entries for small matrices

## Detailed fix by platform

### GitHub Actions

1. `outputs: matrix: ${{ steps.set.outputs.matrix }}` and in the step `echo "matrix=$(jq -c . files.json)" >> "$GITHUB_OUTPUT"`

## Code examples

### Guarded dynamic matrix

```yaml
jobs:
  setup:
    runs-on: ubuntu-latest
    outputs: { matrix: ${{ steps.m.outputs.matrix }} }
    steps:
      - id: m
        run: echo 'matrix={"node":["18","20"]}' >> "$GITHUB_OUTPUT"
  test:
    needs: setup
    if: ${{ needs.setup.outputs.matrix != '' }}
    strategy:
      matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
    runs-on: ubuntu-latest
    steps:
      - run: echo node ${{ matrix.node }}
```

## How to diagnose

1. **Output** — What does the setup job output?
2. **JSON** — Valid and non-empty?
3. **Needs** — Is the producer job run?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-matrix-vector-no-values)
