nektos/act · error
%sExpected a scalar got %v
Error message
%sExpected a scalar got %v
What it means
Type error from Node.checkScalar (schema.go:262): the schema definition has no Mapping/Sequence/OneOf, so it expects a scalar, but the YAML node is a mapping, sequence, alias, or document node. The actual kind is rendered via getStringKind (document/sequence/mapping/scalar/alias/unknown).
Source
Thrown at pkg/schema/schema.go:262
}
isExpr, err := s.checkExpression(node)
if err != nil {
return err
}
if isExpr {
return nil
}
if def.Mapping != nil {
return s.checkMapping(node, def)
} else if def.Sequence != nil {
return s.checkSequence(node, def)
} else if def.OneOf != nil {
return s.checkOneOf(def, node)
}
if node.Kind != yaml.ScalarNode {
return fmt.Errorf("%sExpected a scalar got %v", formatLocation(node), getStringKind(node.Kind))
}
if def.String != nil {
return s.checkString(node, def)
} else if def.Number != nil {
var num float64
return node.Decode(&num)
} else if def.Boolean != nil {
var b bool
return node.Decode(&b)
} else if def.AllowedValues != nil {
s := node.Value
for _, v := range *def.AllowedValues {
if s == v {
return nil
}
}
return fmt.Errorf("%sExpected one of %s got %s", formatLocation(node), strings.Join(*def.AllowedValues, ","), s)View on GitHub (pinned to 4f41128141)
Solutions
- Go to the reported Line/Column and flatten the value to a scalar (plain string/number/bool)
- Fix indentation so the value sits on the same logical line or as a quoted scalar
- Replace anchors/aliases in scalar positions with literal values
Example fix
# before: runs-on: - ubuntu-latest # after: runs-on: ubuntu-latest
Defensive patterns
Strategy: type-guard
Validate before calling
# Keep constrained fields scalar: value on one line, or a quoted multi-line scalar (| / >) where allowed
Type guard
// YAML kind guard before validation:
func isScalar(n *yaml.Node) bool { return n.Kind == yaml.ScalarNode } Try / catch
Fatal validation error; restructure the YAML node to a scalar at the reported line/column.
Prevention
- Watch indentation after a key — one extra space creates a mapping
- Use yamllint to catch structure mistakes early
- Quote scalar values that contain ':' or '-'
When it happens
Trigger: Providing a block where a scalar is required: putting a nested map under `name:`, a YAML list under `runs-on:`, or an anchor/alias node where a plain string is expected.
Common situations: Indentation mistakes that turn a value into a nested mapping; copy-pasting a multi-line snippet into a scalar field; using YAML anchors (&x/*x) in scalar positions.
Related errors
- %sExpected a sequence got %v
- %sExpected a mapping got %v
- expressions are not allowed here
- %sFailed to parse: %s
- %sExpected one of %s got %s
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/19f8a60310b9c461.
Report an issue: GitHub.