{"record":{"id":"edc3daffc14dd628","repo":"hashicorp/terraform","slug":"unrecognized-type-s","errorCode":null,"errorMessage":"unrecognized type: %s","messagePattern":"unrecognized type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configs/hcl2shim/paths.go","lineNumber":148,"sourceCode":"func pathFromFlatmapKeyValue(key string, ty cty.Type) (cty.Path, error) {\n\tvar path cty.Path\n\tvar err error\n\n\tswitch {\n\tcase ty.IsPrimitiveType():\n\t\terr = fmt.Errorf(\"invalid step %q with type %#v\", key, ty)\n\tcase ty.IsObjectType():\n\t\tpath, err = pathFromFlatmapKeyObject(key, ty.AttributeTypes())\n\tcase ty.IsTupleType():\n\t\tpath, err = pathFromFlatmapKeyTuple(key, ty.TupleElementTypes())\n\tcase ty.IsMapType():\n\t\tpath, err = pathFromFlatmapKeyMap(key, ty)\n\tcase ty.IsListType():\n\t\tpath, err = pathFromFlatmapKeyList(key, ty)\n\tcase ty.IsSetType():\n\t\tpath, err = pathFromFlatmapKeySet(key, ty)\n\tdefault:\n\t\terr = fmt.Errorf(\"unrecognized type: %s\", ty.FriendlyName())\n\t}\n\n\tif err != nil {\n\t\treturn path, err\n\t}\n\n\treturn path, nil\n}\n\nfunc pathFromFlatmapKeyTuple(key string, etys []cty.Type) (cty.Path, error) {\n\tvar path cty.Path\n\tvar err error\n\n\tk, rest := pathSplit(key)\n\n\t// we don't need to convert the index keys to paths\n\tif k == \"#\" {\n\t\treturn path, nil","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/configs/hcl2shim/paths.go#L130-L166","documentation":"Returned by pathFromFlatmapKeyValue (paths.go:148) in the default branch of its type switch — the cty.Type matched none of primitive, object, tuple, map, list, or set. This indicates an unrecognized or unsupported type in the flatmap-key-to-path conversion path, such as a capsule type or a dynamic pseudo-type that was not resolved.","triggerScenarios":"Calling requiresReplacePath / pathFromFlatmapKeyValue with a cty.Type that is not one of the six standard structural/primitive kinds. Reached when a schema attribute's type is a capsule or unresolved dynamic reaching the path-shim layer.","commonSituations":"Custom cty capsule types leaking into schema attributes. cty.DynamicPseudoType used where a concrete type was expected. Internally inconsistent type descriptors from a buggy provider schema.","solutions":["Print ty.FriendlyName() (shown in the message) and confirm the type is one flatmap paths can handle.","Resolve any DynamicPseudoType to a concrete type before it reaches the path shim.","Replace unsupported capsule types in schema attributes with standard cty kinds, or handle them in a dedicated code path.","Validate provider schemas with InternalValidate in tests to catch exotic types early."],"exampleFix":"// before — attr Type set to a custom capsule type\nattr := &configschema.Attribute{Type: myCapsule}\n\n// after — use a standard cty kind\nattr := &configschema.Attribute{Type: cty.Map(cty.String)}","handlingStrategy":"validation","validationCode":"// Only the 6 standard kinds are path-navigable\nfunc isPathNavigable(ty cty.Type) bool {\n    return ty.IsPrimitiveType() || ty.IsObjectType() || ty.IsTupleType() ||\n        ty.IsMapType() || ty.IsListType() || ty.IsSetType()\n}","typeGuard":"func isPathNavigable(ty cty.Type) bool {\n    return ty.IsPrimitiveType() || ty.IsObjectType() || ty.IsTupleType() ||\n        ty.IsMapType() || ty.IsListType() || ty.IsSetType()\n}","tryCatchPattern":null,"preventionTips":["Do not put cty capsule types or unresolved DynamicPseudoType into schema attributes that reach the path shim.","Resolve dynamic types to concrete types before decoding/navigating.","Validate schemas with InternalValidate to reject exotic types early."],"tags":["hcl2shim","paths","cty","unrecognized-type"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}