nektos/act · error
expressions are not allowed here
Error message
expressions are not allowed here
What it means
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.
Source
Thrown at pkg/schema/schema.go:133
Schema *Schema
Context []string
}
type FunctionInfo struct {
name string
min int
max int
}
func (s *Node) checkSingleExpression(exprNode actionlint.ExprNode) error {
if len(s.Context) == 0 {
switch exprNode.Token().Kind {
case actionlint.TokenKindInt:
case actionlint.TokenKindFloat:
case actionlint.TokenKindString:
return nil
default:
return fmt.Errorf("expressions are not allowed here")
}
}
funcs := s.GetFunctions()
var err error
actionlint.VisitExprNode(exprNode, func(node, _ actionlint.ExprNode, entering bool) {
if funcCallNode, ok := node.(*actionlint.FuncCallNode); entering && ok {
for _, v := range *funcs {
if strings.EqualFold(funcCallNode.Callee, v.name) {
if v.min > len(funcCallNode.Args) {
err = errors.Join(err, fmt.Errorf("Missing parameters for %s expected >= %v got %v", funcCallNode.Callee, v.min, len(funcCallNode.Args)))
}
if v.max < len(funcCallNode.Args) {
err = errors.Join(err, fmt.Errorf("Too many parameters for %s expected <= %v got %v", funcCallNode.Callee, v.max, len(funcCallNode.Args)))
}
return
}View on GitHub (pinned to 4f41128141)
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
Example fix
# before (context not allowed at this node):
key: ${{ github.event_name }}
# after:
key: 'static-value' Defensive patterns
Strategy: validation
Validate before calling
# Pre-check: at positions where no context is allowed, use only literals
# ${{ 1 }}, ${{ 1.5 }}, ${{ 'text' }} are OK; anything else will be rejected Try / catch
Treat as fatal validation error; surface the location prefix and fix the YAML — retrying unchanged input cannot succeed.
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %sFailed to parse: %s
- %sinsert is not allowed here
- Missing parameters for %s expected >= %v got %v
- Too many parameters for %s expected <= %v got %v
- Unknown Function Call %s
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/6a6e0869ea88362c.
Report an issue: GitHub.