nektos/act · error
Unavailable context: %s
Error message
Unavailable context: %s
What it means
Thrown during property access on a map when a key's reflect.Kind is not String (e.g. an int or bool map key). act only supports case-insensitive string-key lookup for .property access on maps; any other key kind aborts with the offending kind name in the message.
Source
Thrown at pkg/exprparser/interpreter.go:187
return impl.env.Runner, nil
case "secrets":
return impl.env.Secrets, nil
case "vars":
return impl.env.Vars, nil
case "strategy":
return impl.env.Strategy, nil
case "matrix":
return impl.env.Matrix, nil
case "needs":
return impl.env.Needs, nil
case "inputs":
return impl.env.Inputs, nil
case "infinity":
return math.Inf(1), nil
case "nan":
return math.NaN(), nil
default:
return nil, fmt.Errorf("Unavailable context: %s", variableNode.Name)
}
}
func (impl *interperterImpl) evaluateIndexAccess(indexAccessNode *actionlint.IndexAccessNode) (interface{}, error) {
left, err := impl.evaluateNode(indexAccessNode.Operand)
if err != nil {
return nil, err
}
leftValue := reflect.ValueOf(left)
right, err := impl.evaluateNode(indexAccessNode.Index)
if err != nil {
return nil, err
}
rightValue := reflect.ValueOf(right)
View on GitHub (pinned to 4f41128141)
Solutions
- Use index syntax for non-identifier keys: obj['0'] or obj[0] instead of obj.0 where the value is an array.
- Prefer arrays in generated JSON rather than numeric-keyed maps.
- In Go, ensure env maps are map[string]interface{} before evaluation.
Example fix
# before
${{ fromJSON(inputs.map).0.name }}
# after
${{ fromJSON(inputs.map)['0'].name }} Defensive patterns
Strategy: validation
Validate before calling
func mapKeysAllStrings(m map[interface{}]interface{}) bool {
for k := range m {
if reflect.TypeOf(k) == nil || reflect.TypeOf(k).Kind() != reflect.String { return false }
}
return true
} Try / catch
if v, err := interp.Evaluate(expr, 0); err != nil {
if strings.Contains(err.Error(), 'map key not implemented') {
// switch to bracket access with a string index
expr = rewriteDotToBracket(expr)
} else { return err }
} Prevention
- Use bracket access obj['key'] for non-identifier keys
- Decode JSON into map[string]interface{} in Go embedding code
- Prefer arrays over numeric-keyed maps in generated JSON
When it happens
Trigger: fromJSON parses '{"1": ...}'-shaped data where numeric-looking handling yields non-string keys in Go maps; expressions like x.0 on a map whose keys came from JSON numbers; custom Go callers injecting map[int]... into the expression env.
Common situations: Accessing JSON with numeric keys via dot notation; matrix combinations producing non-string keys; Go API users putting arbitrary maps into the interpreter environment.
Related errors
- '%s' in map key not implemented
- 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/9c21d8f069f906d6.
Report an issue: GitHub.