{"record":{"id":"c96fb411a2ef9058","repo":"hashicorp/terraform","slug":"unknown-kind-s","errorCode":null,"errorMessage":"Unknown kind: %s","messagePattern":"Unknown kind: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/legacy/terraform/resource.go","lineNumber":410,"sourceCode":"\t\t\t\t\treturn nil, false\n\t\t\t\t}\n\t\t\t\tif int(i) < 0 || int(i) >= cv.Len() {\n\t\t\t\t\treturn nil, false\n\t\t\t\t}\n\t\t\t\tcurrent = cv.Index(int(i)).Interface()\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\t// This happens when map keys contain \".\" and have a common\n\t\t\t// prefix so were split as path components above.\n\t\t\tactualKey := strings.Join(parts[i-1:], \".\")\n\t\t\tif prevMap, ok := previous.(map[string]interface{}); ok {\n\t\t\t\tv, ok := prevMap[actualKey]\n\t\t\t\treturn v, ok\n\t\t\t}\n\n\t\t\treturn nil, false\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Unknown kind: %s\", cv.Kind()))\n\t\t}\n\t}\n\n\treturn current, true\n}\n\n// unknownCheckWalker\ntype unknownCheckWalker struct {\n\tUnknown bool\n}\n\nfunc (w *unknownCheckWalker) Primitive(v reflect.Value) error {\n\tif v.Interface() == hcl2shim.UnknownVariableValue {\n\t\tw.Unknown = true\n\t}\n\n\treturn nil\n}","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/legacy/terraform/resource.go#L392-L428","documentation":"Panics in ResourceConfig.get (resource.go:410) while walking a dotted key path through raw config via reflection. The switch handles only Map, Slice, and String kinds; any other reflect.Kind (struct, int, bool, pointer) in the raw config tree panics.","triggerScenarios":"Calling ResourceConfig.Get(k) where the raw config value at some path component is a Go struct, primitive (bool/int), or pointer — i.e. raw config not in the map/slice/string shape normally produced by hcl2shim.","commonSituations":"Custom code injecting non-standard Go values into ResourceConfig.Raw, schema/config corruption, or test fixtures using wrong Go types.","solutions":["Ensure raw config values are only map[string]interface{}, []interface{}, or string.","Build raw values via hcl2shim rather than hand-constructing native Go structs.","Never inject pointers or structs into ResourceConfig.Raw/Config."],"exampleFix":"// before\ncfg.Raw = map[string]interface{}{\"x\": MyStruct{...}}\n// after\ncfg.Raw = map[string]interface{}{\"x\": map[string]interface{}{\"a\": \"1\"}}","handlingStrategy":"validation","validationCode":"func rawConfigWalkable(raw interface{}) error {\n    switch v := raw.(type) {\n    case map[string]interface{}:\n        for _, c := range v { if err := rawConfigWalkable(c); err != nil { return err } }\n    case []interface{}:\n        for _, c := range v { if err := rawConfigWalkable(c); err != nil { return err } }\n    case string, nil:\n    default:\n        return fmt.Errorf(\"unsupported raw kind %T in config\", raw)\n    }\n    return nil\n}","typeGuard":"func isWalkableKind(raw interface{}) bool {\n    switch raw.(type) {\n    case map[string]interface{}, []interface{}, string, nil: return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Keep raw config to map/slice/string only.","Build raw values via hcl2shim, not native structs.","Never inject pointers/structs into ResourceConfig.Raw."],"tags":["terraform","config","reflection","panic","internal-invariant"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}