{"record":{"id":"edc3daffc14dd628","repo":"hashicorp/terraform","slug":"unrecognized-type-s","errorCode":null,"errorMessage":"unrecognized type: %s","messagePattern":"unrecognized type: (.+?)","errorType":"validation","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/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/configs/hcl2shim/paths.go#L130-L166","documentation":"Returned by pathFromFlatmapKeyValue when the current type does not match any handled branch (primitive, object, tuple, map, list, set) — i.e. the switch reaches its default. This typically means the type is cty.DynamicPseudoType or a capsule type, neither of which can be navigated by flatmap key segments.","triggerScenarios":"Translating a flatmap key against a schema position whose cty type is dynamic or otherwise non-navigable. Reached via requiresReplacePath and the pathFromFlatmapKey* family when descending through a type that has no flatmap representation.","commonSituations":"Schema attribute typed as cty.DynamicPseudoType appearing inside a RequiresReplace key; legacy state with dynamic-typed slots; custom providers using capsule types that the shim does not understand.","solutions":["Inspect the FriendlyName() in the error to identify the offending type.","If the type is dynamic, replace it with a concrete type so the path can be navigated, or remove the attribute from RequiresReplace.","If a capsule type is involved, encode the value as a concrete primitive (e.g. JSON string) instead.","Regenerate the diff/RequiresReplace list against a concrete-typed schema."],"exampleFix":"// before: attribute typed cty.DynamicPseudoType referenced in RequiresReplace\n// after: attribute typed cty.String (concrete) so the path is navigable","handlingStrategy":"type-guard","validationCode":"func typeIsNavigable(ty cty.Type) bool {\n    return ty.IsPrimitiveType() || ty.IsObjectType() || ty.IsTupleType() ||\n        ty.IsMapType() || ty.IsListType() || ty.IsSetType()\n}","typeGuard":"func typeIsNavigable(ty cty.Type) bool {\n    if ty == cty.DynamicPseudoType { return false }\n    return ty.IsPrimitiveType() || ty.IsObjectType() || ty.IsTupleType() ||\n        ty.IsMapType() || ty.IsListType() || ty.IsSetType()\n}","tryCatchPattern":null,"preventionTips":["Avoid cty.DynamicPseudoType in any attribute reachable from a flatmap path translation.","Encode opaque payloads as JSON strings rather than dynamic types.","Recompute RequiresReplace against a concrete-typed schema."],"tags":["flatmap","hcl2shim","paths","dynamic-type","go"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}