{"record":{"id":"9c21d8f069f906d6","repo":"nektos/act","slug":"unavailable-context-s","errorCode":null,"errorMessage":"Unavailable context: %s","messagePattern":"Unavailable context: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/exprparser/interpreter.go","lineNumber":187,"sourceCode":"\t\treturn impl.env.Runner, nil\n\tcase \"secrets\":\n\t\treturn impl.env.Secrets, nil\n\tcase \"vars\":\n\t\treturn impl.env.Vars, nil\n\tcase \"strategy\":\n\t\treturn impl.env.Strategy, nil\n\tcase \"matrix\":\n\t\treturn impl.env.Matrix, nil\n\tcase \"needs\":\n\t\treturn impl.env.Needs, nil\n\tcase \"inputs\":\n\t\treturn impl.env.Inputs, nil\n\tcase \"infinity\":\n\t\treturn math.Inf(1), nil\n\tcase \"nan\":\n\t\treturn math.NaN(), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unavailable context: %s\", variableNode.Name)\n\t}\n}\n\nfunc (impl *interperterImpl) evaluateIndexAccess(indexAccessNode *actionlint.IndexAccessNode) (interface{}, error) {\n\tleft, err := impl.evaluateNode(indexAccessNode.Operand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tleftValue := reflect.ValueOf(left)\n\n\tright, err := impl.evaluateNode(indexAccessNode.Index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trightValue := reflect.ValueOf(right)\n","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/exprparser/interpreter.go#L169-L205","documentation":"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.","triggerScenarios":"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.","commonSituations":"Accessing JSON with numeric keys via dot notation; matrix combinations producing non-string keys; Go API users putting arbitrary maps into the interpreter environment.","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."],"exampleFix":"# before\n${{ fromJSON(inputs.map).0.name }}\n# after\n${{ fromJSON(inputs.map)['0'].name }}","handlingStrategy":"validation","validationCode":"func mapKeysAllStrings(m map[interface{}]interface{}) bool {\n  for k := range m {\n    if reflect.TypeOf(k) == nil || reflect.TypeOf(k).Kind() != reflect.String { return false }\n  }\n  return true\n}","typeGuard":null,"tryCatchPattern":"if v, err := interp.Evaluate(expr, 0); err != nil {\n  if strings.Contains(err.Error(), 'map key not implemented') {\n    // switch to bracket access with a string index\n    expr = rewriteDotToBracket(expr)\n  } else { return err }\n}","preventionTips":["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"],"tags":["expressions","map-key","type-mismatch","interpreter"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}