nektos/act · error

%sinsert is not allowed here

Error message

%sinsert is not allowed here

What it means

Validation error from Node.checkMapping (schema.go:372): a mapping key contains the special `${{ insert }}` directive but the current Node has an empty Context, so insertion is not permitted at this position. The insert directive is only allowed in mapping keys within contexts that support it.

Source

Thrown at pkg/schema/schema.go:372

	}
	return allErrors
}

func formatLocation(node *yaml.Node) string {
	return fmt.Sprintf("Line: %v Column %v: ", node.Line, node.Column)
}

func (s *Node) checkMapping(node *yaml.Node, def Definition) error {
	if node.Kind != yaml.MappingNode {
		return fmt.Errorf("%sExpected a mapping got %v", formatLocation(node), getStringKind(node.Kind))
	}
	insertDirective := regexp.MustCompile(`\${{\s*insert\s*}}`)
	var allErrors error
	for i, k := range node.Content {
		if i%2 == 0 {
			if insertDirective.MatchString(k.Value) {
				if len(s.Context) == 0 {
					allErrors = errors.Join(allErrors, fmt.Errorf("%sinsert is not allowed here", formatLocation(k)))
				}
				continue
			}

			isExpr, err := s.checkExpression(k)
			if err != nil {
				allErrors = errors.Join(allErrors, err)
				continue
			}
			if isExpr {
				continue
			}
			vdef, ok := def.Mapping.Properties[k.Value]
			if !ok {
				if def.Mapping.LooseValueType == "" {
					allErrors = errors.Join(allErrors, fmt.Errorf("%sUnknown Property %v", formatLocation(k), k.Value))
					continue
				}

View on GitHub (pinned to 4f41128141)

Solutions

  1. Remove the `${{ insert }}` key from this mapping
  2. Move the insert directive into a context that permits it (a node with declared Context, e.g. inside reusable workflow inputs mapping)
  3. Replace insert with explicit keys listing the values you wanted merged

Example fix

# before:
with:
  ${{ insert }}: ignored
  key: value
# after:
with:
  key: value
Defensive patterns

Strategy: validation

Validate before calling

# Grep your workflows for '${{ insert }}' and confirm each occurrence is inside a context-enabled mapping before validation

Try / catch

Fatal validation error — remove or relocate the insert directive.

Prevention

When it happens

Trigger: Writing `${{ insert }}` as a key in a mapping that is validated by a schema node whose Context list is empty — typically top-level or structural positions where expression merging is disallowed.

Common situations: Using the insert directive in the wrong place when templating workflows; assuming `${{ insert }}` works anywhere like general ${{ }} interpolation.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/c00b32c1121cb77f. Report an issue: GitHub.