nektos/act · error

%sExpected a sequence got %v

Error message

%sExpected a sequence got %v

What it means

Type error from Node.checkSequence (schema.go:345): the definition declares a Sequence but the YAML node's Kind is not yaml.SequenceNode. The actual kind name (document/sequence/mapping/scalar/alias) is included.

Source

Thrown at pkg/schema/schema.go:345

	switch k {
	case yaml.DocumentNode:
		return "document"
	case yaml.SequenceNode:
		return "sequence"
	case yaml.MappingNode:
		return "mapping"
	case yaml.ScalarNode:
		return "scalar"
	case yaml.AliasNode:
		return "alias"
	default:
		return "unknown"
	}
}

func (s *Node) checkSequence(node *yaml.Node, def Definition) error {
	if node.Kind != yaml.SequenceNode {
		return fmt.Errorf("%sExpected a sequence got %v", formatLocation(node), getStringKind(node.Kind))
	}
	var allErrors error
	for _, v := range node.Content {
		allErrors = errors.Join(allErrors, (&Node{
			Definition: def.Sequence.ItemType,
			Schema:     s.Schema,
			Context:    append(append([]string{}, s.Context...), s.Schema.GetDefinition(def.Sequence.ItemType).Context...),
		}).UnmarshalYAML(v))
	}
	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 {

View on GitHub (pinned to 4f41128141)

Solutions

  1. Convert the value to a YAML sequence (dash-prefixed items or inline [a, b])
  2. Fix indentation so each item is a list entry, not a mapping key

Example fix

# before:
matrix:
  os:
    linux: true
# after:
matrix:
  os:
    - linux
    - macos
Defensive patterns

Strategy: type-guard

Validate before calling

# Write list fields with explicit dash syntax or inline [a, b] flow style

Type guard

func isSequence(n *yaml.Node) bool { return n.Kind == yaml.SequenceNode }

Try / catch

Fatal validation error — convert the node to a sequence at the reported position.

Prevention

When it happens

Trigger: Providing a scalar or mapping where the schema requires a list: `needs: build` style is fine only if schema allows oneOf; pure sequence fields (e.g. a list-typed env value) given `key: value` or a bare scalar.

Common situations: Forgetting the dash/list syntax; indentation making a list item a nested map; converting a single-value shorthand into a block map.

Related errors


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