nektos/act · error
'%s' in map key not implemented
Error message
'%s' in map key not implemented
What it means
Same code path as the map-key error at pkg/exprparser/interpreter.go:295: property lookup iterates a map with MapRange and rejects any key whose reflect.Kind is not String, embedding the kind name in the message. It guards the dot-notation (.foo) accessor only.
Source
Thrown at pkg/exprparser/interpreter.go:295
}
return string(text), nil
}
return i, nil
case reflect.Map:
iter := left.MapRange()
for iter.Next() {
key := iter.Key()
switch key.Kind() {
case reflect.String:
if strings.EqualFold(key.String(), property) {
return impl.getMapValue(iter.Value())
}
default:
return nil, fmt.Errorf("'%s' in map key not implemented", key.Kind())
}
}
return nil, nil
case reflect.Slice:
var values []interface{}
for i := 0; i < left.Len(); i++ {
value, err := impl.getPropertyValue(left.Index(i).Elem(), property)
if err != nil {
return nil, err
}
values = append(values, value)
}
return values, nilView on GitHub (pinned to 4f41128141)
Solutions
- Switch to bracket access with a string index for such keys.
- Normalize maps to string keys before they enter expressions.
- Restructure source data to use string keys or arrays.
Example fix
# go embedding
// before
env.Vars = map[int]string{1: 'a'}
// after
env.Vars = map[string]string{'1': 'a'} Defensive patterns
Strategy: validation
Validate before calling
func normalizeMapKeys(v interface{}) interface{} {
switch t := v.(type) {
case map[interface{}]interface{}:
out := map[string]interface{}{}
for k, val := range t { out[fmt.Sprintf('%v', k)] = normalizeMapKeys(val) }
return out
case map[string]interface{}:
for k, val := range t { t[k] = normalizeMapKeys(val) }
}
return v
} Prevention
- Inject only map[string]interface{} into the expression env
- Quote numeric keys in source JSON
- Use index syntax for keys that are not valid identifiers
When it happens
Trigger: Evaluating x.prop where x is a map[interface{}]interface{} or map[int]string; JSON decoded with number keys under act's untyped unmarshaling; composite-action inputs building non-string keyed maps.
Common situations: Dot access on fromJSON results with non-string keys; env data injected by custom embedding code; YAML !!int keys flowing into the expression environment.
Related errors
- Unavailable context: %s
- Cannot parse non-string type %v as JSON
- Invalid JSON: %v
- The following format string is invalid: '%s'
- The following format string references more arguments than w
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/b10f1d2c4ad453f7.
Report an issue: GitHub.