{"record":{"id":"c00b32c1121cb77f","repo":"nektos/act","slug":"sinsert-is-not-allowed-here","errorCode":null,"errorMessage":"%sinsert is not allowed here","messagePattern":"(.+?)insert is not allowed here","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/schema/schema.go","lineNumber":372,"sourceCode":"\t}\n\treturn allErrors\n}\n\nfunc formatLocation(node *yaml.Node) string {\n\treturn fmt.Sprintf(\"Line: %v Column %v: \", node.Line, node.Column)\n}\n\nfunc (s *Node) checkMapping(node *yaml.Node, def Definition) error {\n\tif node.Kind != yaml.MappingNode {\n\t\treturn fmt.Errorf(\"%sExpected a mapping got %v\", formatLocation(node), getStringKind(node.Kind))\n\t}\n\tinsertDirective := regexp.MustCompile(`\\${{\\s*insert\\s*}}`)\n\tvar allErrors error\n\tfor i, k := range node.Content {\n\t\tif i%2 == 0 {\n\t\t\tif insertDirective.MatchString(k.Value) {\n\t\t\t\tif len(s.Context) == 0 {\n\t\t\t\t\tallErrors = errors.Join(allErrors, fmt.Errorf(\"%sinsert is not allowed here\", formatLocation(k)))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tisExpr, err := s.checkExpression(k)\n\t\t\tif err != nil {\n\t\t\t\tallErrors = errors.Join(allErrors, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif isExpr {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvdef, ok := def.Mapping.Properties[k.Value]\n\t\t\tif !ok {\n\t\t\t\tif def.Mapping.LooseValueType == \"\" {\n\t\t\t\t\tallErrors = errors.Join(allErrors, fmt.Errorf(\"%sUnknown Property %v\", formatLocation(k), k.Value))\n\t\t\t\t\tcontinue\n\t\t\t\t}","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/schema/schema.go#L354-L390","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using the insert directive in the wrong place when templating workflows; assuming `${{ insert }}` works anywhere like general ${{ }} interpolation.","solutions":["Remove the `${{ insert }}` key from this mapping","Move the insert directive into a context that permits it (a node with declared Context, e.g. inside reusable workflow inputs mapping)","Replace insert with explicit keys listing the values you wanted merged"],"exampleFix":"# before:\nwith:\n  ${{ insert }}: ignored\n  key: value\n# after:\nwith:\n  key: value","handlingStrategy":"validation","validationCode":"# Grep your workflows for '${{ insert }}' and confirm each occurrence is inside a context-enabled mapping before validation","typeGuard":null,"tryCatchPattern":"Fatal validation error — remove or relocate the insert directive.","preventionTips":["Reserve ${{ insert }} for reusable-workflow input mappings that document it","Prefer explicit keys over insert for clarity"],"tags":["go","act","schema-validation","yaml","insert-directive","expressions"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}