{"record":{"id":"6a6e0869ea88362c","repo":"nektos/act","slug":"expressions-are-not-allowed-here","errorCode":null,"errorMessage":"expressions are not allowed here","messagePattern":"expressions are not allowed here","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/schema/schema.go","lineNumber":133,"sourceCode":"\tSchema     *Schema\n\tContext    []string\n}\n\ntype FunctionInfo struct {\n\tname string\n\tmin  int\n\tmax  int\n}\n\nfunc (s *Node) checkSingleExpression(exprNode actionlint.ExprNode) error {\n\tif len(s.Context) == 0 {\n\t\tswitch exprNode.Token().Kind {\n\t\tcase actionlint.TokenKindInt:\n\t\tcase actionlint.TokenKindFloat:\n\t\tcase actionlint.TokenKindString:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"expressions are not allowed here\")\n\t\t}\n\t}\n\n\tfuncs := s.GetFunctions()\n\n\tvar err error\n\tactionlint.VisitExprNode(exprNode, func(node, _ actionlint.ExprNode, entering bool) {\n\t\tif funcCallNode, ok := node.(*actionlint.FuncCallNode); entering && ok {\n\t\t\tfor _, v := range *funcs {\n\t\t\t\tif strings.EqualFold(funcCallNode.Callee, v.name) {\n\t\t\t\t\tif v.min > len(funcCallNode.Args) {\n\t\t\t\t\t\terr = errors.Join(err, fmt.Errorf(\"Missing parameters for %s expected >= %v got %v\", funcCallNode.Callee, v.min, len(funcCallNode.Args)))\n\t\t\t\t\t}\n\t\t\t\t\tif v.max < len(funcCallNode.Args) {\n\t\t\t\t\t\terr = errors.Join(err, fmt.Errorf(\"Too many parameters for %s expected <= %v got %v\", funcCallNode.Callee, v.max, len(funcCallNode.Args)))\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/schema/schema.go#L115-L151","documentation":"Thrown by Node.checkSingleExpression in pkg/schema/schema.go when validating a ${{ }} expression inside a schema node that has an empty Context (no allowed context variables), and the expression token is not a plain literal (int, float, or string). Nodes without context (e.g. run-name fragments or keys where no github/env/vars context is permitted) may only contain constant literals.","triggerScenarios":"A ${{ }} expression referencing any non-literal token (variable access, function call, object access) placed in a schema position whose Context list is empty. Example: putting ${{ github.event.name }} in a location the schema defines without context variables.","commonSituations":"Hand-editing workflow YAML and using context references where only static values are allowed; schema definitions loaded from a JSON schema that omits the context array for that node.","solutions":["Replace the expression with a literal value (number, float, or quoted string) at that location","Move the dynamic reference into a position the schema allows context (e.g. a field with github/env context)","Check the schema JSON for the node in question and confirm which fields accept expressions"],"exampleFix":"# before (context not allowed at this node):\nkey: ${{ github.event_name }}\n# after:\nkey: 'static-value'","handlingStrategy":"validation","validationCode":"# Pre-check: at positions where no context is allowed, use only literals\n# ${{ 1 }}, ${{ 1.5 }}, ${{ 'text' }} are OK; anything else will be rejected","typeGuard":null,"tryCatchPattern":"Treat as fatal validation error; surface the location prefix and fix the YAML — retrying unchanged input cannot succeed.","preventionTips":["Consult the schema node's Context list before adding expressions","Prefer literal values in structural fields (names, keys)","Run `act` schema validation in CI for every workflow change"],"tags":["go","act","schema-validation","expressions","yaml"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}