{"record":{"id":"13880d32e64e96b9","repo":"hashicorp/terraform","slug":"unknown-type-v","errorCode":null,"errorMessage":"unknown type: %#v","messagePattern":"unknown type: %#v","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/legacy/helper/schema/field_reader_config.go","lineNumber":229,"sourceCode":"\t\t\t\tresult[ik] = v\n\t\t\t}\n\t\t}\n\tcase map[string]interface{}:\n\t\tfor ik := range m {\n\t\t\tkey := fmt.Sprintf(\"%s.%s\", k, ik)\n\t\t\tif r.Config.IsComputed(key) {\n\t\t\t\tcomputed = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tv, _ := r.Config.Get(key)\n\t\t\tresult[ik] = v\n\t\t}\n\tcase nil:\n\t\t// the map may have been empty on the configuration, so we leave the\n\t\t// empty result\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown type: %#v\", mraw))\n\t}\n\n\terr := mapValuesToPrimitive(k, result, schema)\n\tif err != nil {\n\t\treturn FieldReadResult{}, nil\n\t}\n\n\tvar value interface{}\n\tif !computed {\n\t\tvalue = result\n\t}\n\n\treturn FieldReadResult{\n\t\tValue:    value,\n\t\tExists:   true,\n\t\tComputed: computed,\n\t}, nil\n}","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/legacy/helper/schema/field_reader_config.go#L211-L247","documentation":"A panic in `ConfigFieldReader.readMap` (internal/legacy/helper/schema/field_reader_config.go:229), default branch of a Go type switch over the raw map value `mraw`. The reader expects the raw value to be one of: string, []interface{}, []map[string]interface{}, map[string]interface{}, or nil. Any other Go type for a map field's raw config value panics with 'unknown type: %#v'. Unlike the Type-based panics, this is triggered by unexpected runtime data shape rather than a bad schema Type.","triggerScenarios":"Reading a TypeMap field from config where the underlying raw value (from the config parser) is a Go type the reader does not handle — e.g. a float64/bool/int raw value landing where a map was expected, or a custom type returned by an interpolation/parser bug.","commonSituations":"Config interpolation producing an unexpected scalar where a map was declared; provider schema declaring TypeMap but config supplying a single scalar value; parser/config-source bugs returning a non-map Go value; mixed computed/interpolated map values.","solutions":["Ensure the config supplies a proper map (object) for TypeMap fields, not a bare scalar.","If interpolating, wrap the value so it lands as map[string]interface{}.","Check the provider schema: if the field is genuinely scalar, change Type from TypeMap to the scalar Type.","Report a parser/provider bug if the config is valid but the raw value is malformed."],"exampleFix":"null","handlingStrategy":"type-guard","validationCode":"// Go (provider/test): ensure map fields receive map-shaped config values\nfunc isMapLike(v interface{}) bool {\n    switch v.(type) {\n    case string, []interface{}, []map[string]interface{}, map[string]interface{}, nil:\n        return true\n    }\n    return false\n}","typeGuard":"// Go: narrow the raw map value before the reader's type switch\nswitch mraw.(type) {\ncase string, []interface{}, []map[string]interface{}, map[string]interface{}, nil:\n    // safe to read\ndefault:\n    return FieldReadResult{}, fmt.Errorf(\"unexpected raw type %T for map field\", mraw)\n}","tryCatchPattern":"// Go: recover from the readMap panic and return a controlled error\ndefer func() {\n    if r := recover(); r != nil {\n        res = FieldReadResult{}\n        err = fmt.Errorf(\"invalid map config value: %v\", r)\n    }\n}()\nres, err = r.readMap(k, schema)","preventionTips":["Supply proper object/map values for TypeMap fields, not bare scalars.","Wrap interpolated values so they resolve to map[string]interface{}.","If a field is genuinely scalar, change its schema Type away from TypeMap.","Add config-acceptance tests covering map field shapes."],"tags":["terraform","provider-sdk","legacy-schema","field-reader","config-reader","type-map","panic","provider-bug"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}