{"record":{"id":"867a1a0c25526d5c","repo":"nektos/act","slug":"error-in-if-expression-if-s-s-867a1a","errorCode":null,"errorMessage":"  ❌  Error in if-expression: \"if: %s\" (%s)","messagePattern":"  ❌  Error in if-expression: \"if: (.+?)\" \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/step.go","lineNumber":309,"sourceCode":"\t\t\t\tdelete(*env, key)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc isStepEnabled(ctx context.Context, expr string, step step, stage stepStage) (bool, error) {\n\trc := step.getRunContext()\n\n\tvar defaultStatusCheck exprparser.DefaultStatusCheck\n\tif stage == stepStagePost {\n\t\tdefaultStatusCheck = exprparser.DefaultStatusCheckAlways\n\t} else {\n\t\tdefaultStatusCheck = exprparser.DefaultStatusCheckSuccess\n\t}\n\n\trunStep, err := EvalBool(ctx, rc.NewStepExpressionEvaluatorExt(ctx, step, stage == stepStageMain), expr, defaultStatusCheck)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"  \\u274C  Error in if-expression: \\\"if: %s\\\" (%s)\", expr, err)\n\t}\n\n\treturn runStep, nil\n}\n\nfunc isContinueOnError(ctx context.Context, expr string, step step, _ stepStage) (bool, error) {\n\t// https://github.com/github/docs/blob/3ae84420bd10997bb5f35f629ebb7160fe776eae/content/actions/reference/workflow-syntax-for-github-actions.md?plain=true#L962\n\tif len(strings.TrimSpace(expr)) == 0 {\n\t\treturn false, nil\n\t}\n\n\trc := step.getRunContext()\n\n\tcontinueOnError, err := EvalBool(ctx, rc.NewStepExpressionEvaluator(ctx, step), expr, exprparser.DefaultStatusCheckNone)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"  \\u274C  Error in continue-on-error-expression: \\\"continue-on-error: %s\\\" (%s)\", expr, err)\n\t}\n","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/runner/step.go#L291-L327","documentation":"A step-level `if:` expression failed to evaluate. isStepEnabled runs the expression through NewStepExpressionEvaluatorExt with DefaultStatusCheckSuccess (or Always for the post stage); a syntax error, unknown context/function, or type error yields this error, which usually marks the step and job failed unless continue-on-error applies.","triggerScenarios":"`steps.<id>.if:` references an unavailable context (e.g. `needs` inside a non-dependent job, or a matrix key that doesn't exist), has invalid syntax, uses an undefined function, or compares incompatible types in a way the exprparser rejects.","commonSituations":"`if: ${{ steps.x.outputs.y }}` where step id `x` is misspelled (returns null rather than erroring — but a typo'd function or unbalanced parens does error); copying job-level expressions with `needs.*.result` when `needs` is absent; expressions using newer GitHub functions not yet implemented in act's exprparser version.","solutions":["Read the inner error text in parentheses — it pinpoints the parse/eval failure.","Check the expression for syntax issues: balanced `${{ }}`, `==` not `=`, quoted strings.","Confirm every context used exists at step scope (steps, env, matrix, github, runner, needs-if-declared, job, inputs for reusable workflows).","If a recently added GitHub function is used, check act's exprparser support or pin to functions act implements."],"exampleFix":"# before\n- if: ${{ steps.checks.outputs.ok == 'true' && }}   # dangling operator\n# after\n- if: ${{ steps.checks.outputs.ok == 'true' }}","handlingStrategy":"validation","validationCode":"- run: actionlint .github/workflows/workflow.yml  # catches invalid step if-expressions","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep step if-expressions minimal and step-scoped.","Verify step ids referenced in if-expressions exist.","Quote string comparisons (== 'true')."],"tags":["expressions","steps","if-condition","validation"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}