{"record":{"id":"babcc1ca3c167501","repo":"nektos/act","slug":"sfailed-to-match-s-w","errorCode":null,"errorMessage":"%sFailed to match %s: %w","messagePattern":"(.+?)Failed to match (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/schema/schema.go","lineNumber":321,"sourceCode":"\t\t}\n\t}\n\treturn nil\n}\n\nfunc (s *Node) checkOneOf(def Definition, node *yaml.Node) error {\n\tvar allErrors error\n\tfor _, v := range *def.OneOf {\n\t\tsub := &Node{\n\t\t\tDefinition: v,\n\t\t\tSchema:     s.Schema,\n\t\t\tContext:    append(append([]string{}, s.Context...), s.Schema.GetDefinition(v).Context...),\n\t\t}\n\n\t\terr := sub.UnmarshalYAML(node)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tallErrors = errors.Join(allErrors, fmt.Errorf(\"%sFailed to match %s: %w\", formatLocation(node), v, err))\n\t}\n\treturn allErrors\n}\n\nfunc getStringKind(k yaml.Kind) string {\n\tswitch k {\n\tcase yaml.DocumentNode:\n\t\treturn \"document\"\n\tcase yaml.SequenceNode:\n\t\treturn \"sequence\"\n\tcase yaml.MappingNode:\n\t\treturn \"mapping\"\n\tcase yaml.ScalarNode:\n\t\treturn \"scalar\"\n\tcase yaml.AliasNode:\n\t\treturn \"alias\"\n\tdefault:\n\t\treturn \"unknown\"","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/schema/schema.go#L303-L339","documentation":"Error from Node.checkOneOf (schema.go:321): the node failed to validate against every alternative in the schema's OneOf list; each alternative's failure is joined as 'Failed to match <type>: <err>'. Returned when no alternative matched, i.e. union-type resolution failed.","triggerScenarios":"A value that fits none of the declared alternatives, e.g. a field that accepts either a string or a sequence of strings receiving a mapping. Each sub-Node is validated with merged Context; the first success returns nil, otherwise all errors accumulate.","commonSituations":"GitHub schema fields with polymorphic shapes (string | list | object) getting a wrong-shape value; indentation or YAML type coercion (`on:`, `true` → bool) producing unexpected node kinds.","solutions":["Read each 'Failed to match <alt>' branch — the alt that is closest to your intent shows what shape it wanted","Restructure the YAML value to one of the declared alternative shapes","Quote strings that YAML might coerce (on/off/true/yes) to avoid accidental type changes"],"exampleFix":"# before (expects string or list-of-string, got mapping):\nneeds:\n  build: true\n# after:\nneeds: build\n# or\nneeds: [build, test]","handlingStrategy":"validation","validationCode":"# For polymorphic fields, pre-check your value matches at least one documented shape (string OR list OR map) per the GitHub schema","typeGuard":null,"tryCatchPattern":"Inspect every 'Failed to match <alt>' branch, pick the intended alternative, reshape the value accordingly.","preventionTips":["Quote on/yes/true-like values that YAML coerces into non-strings","Prefer the simplest allowed shape (scalar) when valid","Validate with act's schema in CI before merge"],"tags":["go","act","schema-validation","oneof","union-type","yaml"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}