[GH-ISSUE #1064] panic: reflect: slice index out of range #618

Closed
opened 2026-03-01 21:44:59 +03:00 by kerem · 0 comments
Owner

Originally created by @ChristopherHX on GitHub (Mar 21, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1064

System information

act version: f09cdb8443

Expected behaviour

fromjson('[]')[0] evaluates to null

Actual behaviour

panic: reflect: slice index out of range

Workflow and/or repository

workflow
on: push
jobs:
  testb:
    if: fromjson('[]')[0] == ''
    runs-on: ubuntu-latest
    steps:
    - run: echo ${{github.workspace}}

Steps to reproduce

act

act output

Log
time="2022-03-21T20:33:40+01:00" level=debug msg="Loading environment from C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\.env"
time="2022-03-21T20:33:40+01:00" level=debug msg="Loading secrets from C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\.secrets"
time="2022-03-21T20:33:40+01:00" level=debug msg="Loading workflow 'C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\reflect-from-zero.yml'"
time="2022-03-21T20:33:40+01:00" level=debug msg="Reading workflow 'C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\reflect-from-zero.yml'"
time="2022-03-21T20:33:40+01:00" level=debug msg="Planning event: push"
time="2022-03-21T20:33:40+01:00" level=debug msg="Loading slug from git directory 'C:\\Users\\Christopher\\github-actions-act-runner\\.git'"
time="2022-03-21T20:33:40+01:00" level=debug msg="Loading revision from git directory 'C:\\Users\\Christopher\\github-actions-act-runner\\.git'"
time="2022-03-21T20:33:40+01:00" level=debug msg="Found revision: 58ae37abc6c2244d91822b8ba536aa0a8b829632\n"
time="2022-03-21T20:33:40+01:00" level=debug msg="HEAD points to '58ae37abc6c2244d91822b8ba536aa0a8b829632'"
time="2022-03-21T20:33:40+01:00" level=debug msg="using github ref: refs/heads/main"
time="2022-03-21T20:33:40+01:00" level=debug msg="Found revision: 58ae37abc6c2244d91822b8ba536aa0a8b829632\n"
time="2022-03-21T20:33:40+01:00" level=debug msg="evaluating expression 'fromjson('[]')[0] == '''"
panic: reflect: slice index out of range

goroutine 29 [running]:
reflect.Value.Index(0xd712a0, 0xc000004090, 0x97, 0x0, 0x141a400, 0x0, 0x0)
        C:/Users/Christopher/Downloads/go/src/reflect/value.go:962 +0x1f2
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateIndexAccess(0xc0003c9f80, 0xc00041a080, 0xc0003c8270, 0x0, 0xc0004df940, 0xcd7af7)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:173 +0x1fc
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4c00, 0xc00041a080, 0x0, 0x0, 0xe1fd40, 0xca9736)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:102 +0x1c5
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateCompare(0xc0003c9f80, 0xc000428420, 0xd76260, 0x141a408, 0x0, 0x0)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:281 +0x65
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4ba0, 0xc000428420, 0xd76260, 0x141a408, 0x0, 0x0)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:110 +0x62e
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateLogicalCompare(0xc0003c9f80, 0xc000428480, 0x30, 0xc000428480, 0xca5395, 0xc0005a0000)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:497 +0x135
github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4c40, 0xc000428480, 0x0, 0xc0004dfb68, 0xc000486080, 0x19)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:112 +0x2ca
github.com/nektos/act/pkg/exprparser.(*interperterImpl).Evaluate(0xc0003c9f80, 0xc0003b89a8, 0x17, 0x1, 0xc00060bc10, 0x1, 0x1, 0x1)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:82 +0x170
github.com/nektos/act/pkg/runner.expressionEvaluator.evaluate(0xfc4a80, 0xc0003c9f80, 0xc0003b89a8, 0x17, 0xc00060bc01, 0xc00060bca8, 0x51bf2a, 0xe79be0, 0xea7660)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/expression.go:131 +0xfb
github.com/nektos/act/pkg/runner.EvalBool(0xfd3a70, 0xc000397120, 0xc0003b89a8, 0x17, 0x8, 0x2, 0x2030001)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/expression.go:233 +0x72
github.com/nektos/act/pkg/runner.(*RunContext).isEnabled(0xc0003430e0, 0xfd6128, 0xc000428180, 0x1dec3e8dc80, 0x30, 0x30)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/run_context.go:427 +0xdc
github.com/nektos/act/pkg/runner.(*RunContext).Executor.func1(0xfd6128, 0xc000428180, 0x0, 0xc00060be58)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/run_context.go:284 +0x4e
github.com/nektos/act/pkg/common.Executor.Finally.func1(0xfd6128, 0xc000428180, 0xd7de60, 0xfb4470)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:177 +0x53
github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1.1(0xfd6128, 0xc0003c84e0, 0xefd601, 0x0)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/runner.go:170 +0x3b0
github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xfd6128, 0xc0003c84e0, 0xc0000ec060, 0xc0000ec0c0)
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:102 +0x59
created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1
        C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:100 +0xd9
exit status 2
Originally created by @ChristopherHX on GitHub (Mar 21, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1064 ## System information `act` version: f09cdb844367189aafe2f3af5795d3136db6b290 ## Expected behaviour `fromjson('[]')[0]` evaluates to null ## Actual behaviour ``` panic: reflect: slice index out of range ``` ## Workflow and/or repository <details> <summary>workflow</summary> ```none on: push jobs: testb: if: fromjson('[]')[0] == '' runs-on: ubuntu-latest steps: - run: echo ${{github.workspace}} ``` </details> ## Steps to reproduce act ## `act` output <details> <summary>Log</summary> ```none time="2022-03-21T20:33:40+01:00" level=debug msg="Loading environment from C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\.env" time="2022-03-21T20:33:40+01:00" level=debug msg="Loading secrets from C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\.secrets" time="2022-03-21T20:33:40+01:00" level=debug msg="Loading workflow 'C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\reflect-from-zero.yml'" time="2022-03-21T20:33:40+01:00" level=debug msg="Reading workflow 'C:\\Users\\Christopher\\github-actions-act-runner\\act-pr-1056\\reflect-from-zero.yml'" time="2022-03-21T20:33:40+01:00" level=debug msg="Planning event: push" time="2022-03-21T20:33:40+01:00" level=debug msg="Loading slug from git directory 'C:\\Users\\Christopher\\github-actions-act-runner\\.git'" time="2022-03-21T20:33:40+01:00" level=debug msg="Loading revision from git directory 'C:\\Users\\Christopher\\github-actions-act-runner\\.git'" time="2022-03-21T20:33:40+01:00" level=debug msg="Found revision: 58ae37abc6c2244d91822b8ba536aa0a8b829632\n" time="2022-03-21T20:33:40+01:00" level=debug msg="HEAD points to '58ae37abc6c2244d91822b8ba536aa0a8b829632'" time="2022-03-21T20:33:40+01:00" level=debug msg="using github ref: refs/heads/main" time="2022-03-21T20:33:40+01:00" level=debug msg="Found revision: 58ae37abc6c2244d91822b8ba536aa0a8b829632\n" time="2022-03-21T20:33:40+01:00" level=debug msg="evaluating expression 'fromjson('[]')[0] == '''" panic: reflect: slice index out of range goroutine 29 [running]: reflect.Value.Index(0xd712a0, 0xc000004090, 0x97, 0x0, 0x141a400, 0x0, 0x0) C:/Users/Christopher/Downloads/go/src/reflect/value.go:962 +0x1f2 github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateIndexAccess(0xc0003c9f80, 0xc00041a080, 0xc0003c8270, 0x0, 0xc0004df940, 0xcd7af7) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:173 +0x1fc github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4c00, 0xc00041a080, 0x0, 0x0, 0xe1fd40, 0xca9736) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:102 +0x1c5 github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateCompare(0xc0003c9f80, 0xc000428420, 0xd76260, 0x141a408, 0x0, 0x0) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:281 +0x65 github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4ba0, 0xc000428420, 0xd76260, 0x141a408, 0x0, 0x0) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:110 +0x62e github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateLogicalCompare(0xc0003c9f80, 0xc000428480, 0x30, 0xc000428480, 0xca5395, 0xc0005a0000) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:497 +0x135 github.com/nektos/act/pkg/exprparser.(*interperterImpl).evaluateNode(0xc0003c9f80, 0xfc4c40, 0xc000428480, 0x0, 0xc0004dfb68, 0xc000486080, 0x19) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:112 +0x2ca github.com/nektos/act/pkg/exprparser.(*interperterImpl).Evaluate(0xc0003c9f80, 0xc0003b89a8, 0x17, 0x1, 0xc00060bc10, 0x1, 0x1, 0x1) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/exprparser/interpreter.go:82 +0x170 github.com/nektos/act/pkg/runner.expressionEvaluator.evaluate(0xfc4a80, 0xc0003c9f80, 0xc0003b89a8, 0x17, 0xc00060bc01, 0xc00060bca8, 0x51bf2a, 0xe79be0, 0xea7660) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/expression.go:131 +0xfb github.com/nektos/act/pkg/runner.EvalBool(0xfd3a70, 0xc000397120, 0xc0003b89a8, 0x17, 0x8, 0x2, 0x2030001) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/expression.go:233 +0x72 github.com/nektos/act/pkg/runner.(*RunContext).isEnabled(0xc0003430e0, 0xfd6128, 0xc000428180, 0x1dec3e8dc80, 0x30, 0x30) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/run_context.go:427 +0xdc github.com/nektos/act/pkg/runner.(*RunContext).Executor.func1(0xfd6128, 0xc000428180, 0x0, 0xc00060be58) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/run_context.go:284 +0x4e github.com/nektos/act/pkg/common.Executor.Finally.func1(0xfd6128, 0xc000428180, 0xd7de60, 0xfb4470) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:177 +0x53 github.com/nektos/act/pkg/runner.(*runnerImpl).NewPlanExecutor.func1.1(0xfd6128, 0xc0003c84e0, 0xefd601, 0x0) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/runner/runner.go:170 +0x3b0 github.com/nektos/act/pkg/common.NewParallelExecutor.func1.1(0xfd6128, 0xc0003c84e0, 0xc0000ec060, 0xc0000ec0c0) C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:102 +0x59 created by github.com/nektos/act/pkg/common.NewParallelExecutor.func1 C:/Users/Christopher/github-actions-act-runner/act-pr-1056/pkg/common/executor.go:100 +0xd9 exit status 2 ``` </details>
kerem 2026-03-01 21:44:59 +03:00
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#618
No description provided.