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.
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.
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.