[GH-ISSUE #2447] ERRO[0010] Error while evaluating matrix: Invalid JSON: invalid character '$' looking for beginning of value #1124

Closed
opened 2026-03-01 21:49:05 +03:00 by kerem · 8 comments
Owner

Originally created by @brianjmurrell on GitHub (Sep 10, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2447

Bug report info

act version:            0.2.66
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 12
Docker host:            unix:///run/user/1001/podman/podman.sock
Sockets found:
        /var/run/docker.sock(broken)
        $XDG_RUNTIME_DIR/podman/podman.sock
Config files:           
        /home/brian/.config/act/actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
        /home/brian/.actrc:
                -s GITHUB_TOKEN=[redacted]
                --container-daemon-socket=unix:///run/user/1001/podman/podman.sock
Build info:
        Go version:            go1.22.6
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -buildmode:           pie
                -compiler:            gc
                -trimpath:            true
                DefaultGODEBUG:       httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
                CGO_ENABLED:          1
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        5.2.2
        Engine runtime:        crun
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay
        Registry URI:          
        OS:                    fedora
        OS type:               linux
        OS version:            40
        OS arch:               amd64
        OS kernel:             6.10.6-200.fc40.x86_64
        OS CPU:                12
        OS memory:             63943 MB
        Security options:
                name=seccomp,profile=default
                name=rootless
                name=selinux

Command used with act

act --artifact-server-path=/var/tmp/artifacts --use-new-action-cache=false --pull=false -P self-hosted=-self-hosted -P light=-self-hosted -j Call-RPM-Build

Describe issue

When a job is skipped due to a needs being skipped, it doesn't actually skip but instead emits an error from the job:

time="2024-09-10T15:09:27-04:00" level=error msg="Error while evaluating matrix: Invalid JSON: invalid character '$' looking for beginning of value"
time="2024-09-10T15:09:27-04:00" level=fatal msg="Failed to decode node {4 0 !!map   <nil> [0xc0000212c0 0xc000021360]    289 9} into *map[string][]interface {}: yaml: unmarshal errors:\n  line 289: cannot unmarshal !!str `${{ fro...` into []interface {}"

No response

Workflow content


  Build-RPM:
    name: Build RPM
    permissions:
      statuses: write
    runs-on: [self-hosted, docker]
    needs: [Calc-rpm-build-matrix,
            Import-commit-message]
    if: 
        (inputs.BRANCH != '' ||
         needs.Import-commit-pragmas.outputs.run-gha == 'true' ||
         github.event_name == 'workflow_dispatch') &&
        needs.Import-commit-pragmas.outputs.rpm-test-version == '' &&
        needs.Create-symlinks.result == 'success' &&
        ((!cancelled()) || success() || failure())
    strategy:
      matrix:
        distro: ${{ fromJSON(needs.Calc-rpm-build-matrix.outputs.matrix) }}
      fail-fast: false
    env:

Relevant log output

Too much output to parse through line by line ensuring that no private/sensitive data is being sent, such as I found being sent from my actrc file.

Additional information

In this run that emits the error, Calc-rpm-build-matrix is skipped, so Build-RPM should be also but clearly it's not since the line 298 being complained about is the line:

distro: ${{ fromJSON(needs.Calc-rpm-build-matrix.outputs.matrix) }}

from the strategy -> matrix in the workflow snippet above.

If the error and cause from what I have provided is not obvious enough, I will see if I can distill down my complicated workflows into a simple reproducer.

Originally created by @brianjmurrell on GitHub (Sep 10, 2024). Original GitHub issue: https://github.com/nektos/act/issues/2447 ### Bug report info ```plain text act version: 0.2.66 GOOS: linux GOARCH: amd64 NumCPU: 12 Docker host: unix:///run/user/1001/podman/podman.sock Sockets found: /var/run/docker.sock(broken) $XDG_RUNTIME_DIR/podman/podman.sock Config files: /home/brian/.config/act/actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 /home/brian/.actrc: -s GITHUB_TOKEN=[redacted] --container-daemon-socket=unix:///run/user/1001/podman/podman.sock Build info: Go version: go1.22.6 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: pie -compiler: gc -trimpath: true DefaultGODEBUG: httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1 CGO_ENABLED: 1 GOARCH: amd64 GOOS: linux GOAMD64: v1 Docker Engine: Engine version: 5.2.2 Engine runtime: crun Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay Registry URI: OS: fedora OS type: linux OS version: 40 OS arch: amd64 OS kernel: 6.10.6-200.fc40.x86_64 OS CPU: 12 OS memory: 63943 MB Security options: name=seccomp,profile=default name=rootless name=selinux ``` ### Command used with act ```sh act --artifact-server-path=/var/tmp/artifacts --use-new-action-cache=false --pull=false -P self-hosted=-self-hosted -P light=-self-hosted -j Call-RPM-Build ``` ### Describe issue When a job is skipped due to a `needs` being skipped, it doesn't actually skip but instead emits an error from the job: ``` time="2024-09-10T15:09:27-04:00" level=error msg="Error while evaluating matrix: Invalid JSON: invalid character '$' looking for beginning of value" time="2024-09-10T15:09:27-04:00" level=fatal msg="Failed to decode node {4 0 !!map <nil> [0xc0000212c0 0xc000021360] 289 9} into *map[string][]interface {}: yaml: unmarshal errors:\n line 289: cannot unmarshal !!str `${{ fro...` into []interface {}" ``` ### Link to GitHub repository _No response_ ### Workflow content ```yml … Build-RPM: name: Build RPM permissions: statuses: write runs-on: [self-hosted, docker] needs: [Calc-rpm-build-matrix, Import-commit-message] if: (inputs.BRANCH != '' || needs.Import-commit-pragmas.outputs.run-gha == 'true' || github.event_name == 'workflow_dispatch') && needs.Import-commit-pragmas.outputs.rpm-test-version == '' && needs.Create-symlinks.result == 'success' && ((!cancelled()) || success() || failure()) strategy: matrix: distro: ${{ fromJSON(needs.Calc-rpm-build-matrix.outputs.matrix) }} fail-fast: false env: … ``` ### Relevant log output ```sh Too much output to parse through line by line ensuring that no private/sensitive data is being sent, such as I found being sent from my actrc file. ``` ### Additional information In this run that emits the error, `Calc-rpm-build-matrix` is skipped, so `Build-RPM` should be also but clearly it's not since the line 298 being complained about is the line: ``` distro: ${{ fromJSON(needs.Calc-rpm-build-matrix.outputs.matrix) }} ``` from the `strategy` -> `matrix` in the workflow snippet above. If the error and cause from what I have provided is not obvious enough, I will see if I can distill down my complicated workflows into a simple reproducer.
Author
Owner

@ChristopherHX commented on GitHub (Sep 10, 2024):

Yes this is a known issue at least for me and has been raised a few times, order of if and matrix is incorrect.

Keep in mind I can't handle this issue tracker alone and long standing issues like this get down priotised by me as my usecase doesn't depend on this part of act

<!-- gh-comment-id:2341868172 --> @ChristopherHX commented on GitHub (Sep 10, 2024): Yes this is a known issue at least for me and has been raised a few times, order of if and matrix is incorrect. _Keep in mind I can't handle this issue tracker alone and long standing issues like this get down priotised by me as my usecase doesn't depend on this part of act_
Author
Owner

@brianjmurrell commented on GitHub (Sep 10, 2024):

Yes this is a known issue at least for me and has been raised a few times, order of if and matrix is incorrect.

Am I understanding correctly that you are suggesting that I need to move strategy before if:? A little experiment here seems to confirm that is the case.

I was not aware that there was ordering specifics in GitHub's workflow files. TIL. Is there any documentation on the ordering specifics so that I don't fall into this trap again because it seems I have a different job that is being executed in act that does not get executed on GitHub:

  Calc-rpm-build-matrix:
    name: Calculate RPM Build Matrix
    runs-on: [self-hosted, wolf]
    needs: [Import-commit-pragmas, Create-symlinks, Import-commit-message]
    if: needs.Import-commit-pragmas.outputs.skip-build != 'true'
    outputs:
      distros: ${{ steps.distros.outputs.text }}
      matrix: ${{ steps.matrix.outputs.text }}
    steps:

when Create-symlinks is skipped.

Keep in mind I can't handle this issue tracker alone and long standing issues like this get down priotised by me as my usecase doesn't depend on this part of act

Understood. I did check the issue log before opening this issue but I didn't see anything matching. Maybe my search was just not good enough.

<!-- gh-comment-id:2341885070 --> @brianjmurrell commented on GitHub (Sep 10, 2024): > Yes this is a known issue at least for me and has been raised a few times, order of if and matrix is incorrect. ~~Am I understanding correctly that you are suggesting that I need to move `strategy` before `if:`?~~ A little experiment here seems to confirm that is the case. I was not aware that there was ordering specifics in GitHub's workflow files. TIL. Is there any documentation on the ordering specifics so that I don't fall into this trap again because it seems I have a different job that is being executed in _act_ that does not get executed on GitHub: ```yaml Calc-rpm-build-matrix: name: Calculate RPM Build Matrix runs-on: [self-hosted, wolf] needs: [Import-commit-pragmas, Create-symlinks, Import-commit-message] if: needs.Import-commit-pragmas.outputs.skip-build != 'true' outputs: distros: ${{ steps.distros.outputs.text }} matrix: ${{ steps.matrix.outputs.text }} steps: ``` when `Create-symlinks` is skipped. > Keep in mind I can't handle this issue tracker alone and long standing issues like this get down priotised by me as my usecase doesn't depend on this part of act Understood. I did check the issue log before opening this issue but I didn't see anything matching. Maybe my search was just not good enough.
Author
Owner

@ChristopherHX commented on GitHub (Sep 10, 2024):

No order in yaml doesn't matter, act's evaluation order of the parsed job is inverted compared to GitHub Actions

<!-- gh-comment-id:2341887821 --> @ChristopherHX commented on GitHub (Sep 10, 2024): No order in yaml doesn't matter, act's evaluation order of the parsed job is inverted compared to GitHub Actions
Author
Owner

@brianjmurrell commented on GitHub (Sep 10, 2024):

So what does that mean for the job I pasted above? What statements do I have out of order for act in that one?

<!-- gh-comment-id:2341896871 --> @brianjmurrell commented on GitHub (Sep 10, 2024): So what does that mean for the job I pasted above? What statements do I have out of order for _act_ in that one?
Author
Owner

@ChristopherHX commented on GitHub (Sep 10, 2024):

Act has a bug, not your workflow

English is my foreign language, expect issues with my language skills of explaining what I mean

<!-- gh-comment-id:2341909108 --> @ChristopherHX commented on GitHub (Sep 10, 2024): Act has a bug, not your workflow English is my foreign language, expect issues with my language skills of explaining what I mean
Author
Owner

@brianjmurrell commented on GitHub (Sep 10, 2024):

Act has a bug, not your workflow

Ahhh. OK. Is it an existing issue that this could be closed as a duplicate of and that I can subscribe to?

English is my foreign language, expect issues with my language skills of explaining what I mean

Your English is excellent. I suspect the low-bandwidth of the medium has more to do with any misunderstandings than your English.

<!-- gh-comment-id:2341919886 --> @brianjmurrell commented on GitHub (Sep 10, 2024): > Act has a bug, not your workflow Ahhh. OK. Is it an existing issue that this could be closed as a duplicate of and that I can subscribe to? > English is my foreign language, expect issues with my language skills of explaining what I mean Your English is excellent. I suspect the low-bandwidth of the medium has more to do with any misunderstandings than your English.
Author
Owner

@ChristopherHX commented on GitHub (Sep 11, 2024):

Is it an existing issue that this could be closed as a duplicate of and that I can subscribe to?

Yes, but no I don't have a quick lookup table to tell you the number.
In such an issue chaos I sometimes not even reference all reports of the bug I fix in some PR, so some never get notified.
The stale bot might have closed the issue already without any fix.

<!-- gh-comment-id:2344687622 --> @ChristopherHX commented on GitHub (Sep 11, 2024): > Is it an existing issue that this could be closed as a duplicate of and that I can subscribe to? Yes, but no I don't have a quick lookup table to tell you the number. In such an issue chaos I sometimes not even reference all reports of the bug I fix in some PR, so some never get notified. The stale bot might have closed the issue already without any fix.
Author
Owner

@ChristopherHX commented on GitHub (Sep 26, 2024):

Duplicate of https://github.com/nektos/act/issues/1482, but not on my planning board

<!-- gh-comment-id:2377881738 --> @ChristopherHX commented on GitHub (Sep 26, 2024): Duplicate of <https://github.com/nektos/act/issues/1482>, but not on my planning board
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1124
No description provided.