GitHub Actions join() called on a non-array value
join(array, separator) concatenates array elements into a string. Passing a scalar, object, or null where an array is expected is an evaluation error or yields the raw scalar rather than a joined list.
What this error means
An expression using join() fails to evaluate or returns an unexpected single value because its input was not an array.
github-actions
Error: join() expects an array as its first argument but received a string.
run: echo "${{ join(github.event.head_commit.message, ', ') }}"Common causes
Scalar passed instead of an array
join() needs an array; a single string or number is not iterable for joining.
fromJSON result was not an array
If the JSON parsed to an object or scalar, join() has nothing to iterate.
How to fix it
Pass an actual array
- Use an array-typed context value (e.g. github.event.commits) or build one with fromJSON.
- Confirm the value is a list, not an object or scalar.
.github/workflows/ci.yml
run: echo "${{ join(fromJSON('["a","b","c"]'), ', ') }}"Wrap a single value before joining
- If you only have one value, there is nothing to join - reference it directly.
- For optional lists, default to an empty array via fromJSON(’[]’).
How to prevent it
- Verify the argument to join() is an array type.
- Default optional arrays to [] so join() never sees a scalar.
Related guides
GitHub Actions join() / toJSON Misuse on Non-Array ValuesFix GitHub Actions join() and toJSON misuse - calling join() on a scalar, or expecting join() to walk object…
GitHub Actions Dynamic Matrix from fromJSON Fails - Not an ArrayFix GitHub Actions dynamic matrix errors - a matrix built from fromJSON of a job output that is empty, not va…
GitHub Actions startsWith expects a string but received nullFix a startsWith() expression error when its argument resolves to null because the referenced context value i…