{"record":{"id":"a27451cacdd33f71","repo":"hashicorp/terraform","slug":"resource-identity-schema-not-found-for-type-q-a27451","errorCode":null,"errorMessage":"resource identity schema not found for type %q","messagePattern":"resource identity schema not found for type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/grpcwrap/provider6.go","lineNumber":821,"sourceCode":"func (p *provider6) GetResourceIdentitySchemas(_ context.Context, req *tfplugin6.GetResourceIdentitySchemas_Request) (*tfplugin6.GetResourceIdentitySchemas_Response, error) {\n\tresp := &tfplugin6.GetResourceIdentitySchemas_Response{\n\t\tIdentitySchemas: map[string]*tfplugin6.ResourceIdentitySchema{},\n\t\tDiagnostics:     []*tfplugin6.Diagnostic{},\n\t}\n\n\tfor name, schema := range p.identitySchemas.IdentityTypes {\n\t\tresp.IdentitySchemas[name] = convert.ResourceIdentitySchemaToProto(schema)\n\t}\n\n\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, p.identitySchemas.Diagnostics)\n\treturn resp, nil\n}\n\nfunc (p *provider6) UpgradeResourceIdentity(_ context.Context, req *tfplugin6.UpgradeResourceIdentity_Request) (*tfplugin6.UpgradeResourceIdentity_Response, error) {\n\tresp := &tfplugin6.UpgradeResourceIdentity_Response{}\n\tresource, ok := p.identitySchemas.IdentityTypes[req.TypeName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"resource identity schema not found for type %q\", req.TypeName)\n\t}\n\tty := resource.Body.ImpliedType()\n\n\tupgradeResp := p.provider.UpgradeResourceIdentity(providers.UpgradeResourceIdentityRequest{\n\t\tTypeName:        req.TypeName,\n\t\tVersion:         req.Version,\n\t\tRawIdentityJSON: req.RawIdentity.Json,\n\t})\n\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, upgradeResp.Diagnostics)\n\n\tif upgradeResp.Diagnostics.HasErrors() {\n\t\treturn resp, nil\n\t}\n\n\tdv, err := encodeDynamicValue6(upgradeResp.UpgradedIdentity, ty)\n\tif err != nil {\n\t\tresp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)\n\t\treturn resp, nil","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/grpcwrap/provider6.go#L803-L839","documentation":"Returned by the tfplugin6 UpgradeResourceIdentity handler when the type is absent from p.identitySchemas.IdentityTypes (the dedicated identity-schema map, separate from ResourceTypes). Without a registered identity schema there is no target type to encode the upgraded identity into, so the upgrade is refused.","triggerScenarios":"An UpgradeResourceIdentity RPC whose req.TypeName is missing from p.identitySchemas.IdentityTypes; the map lookup returns ok=false.","commonSituations":"Terraform core asks to upgrade identity for a resource that never declared one; identity state referencing a type the provider no longer knows; version skew where core has identity state but provider lacks identity schema.","solutions":["Confirm via `terraform providers schema -json` that the type exposes an identity schema.","Upgrade the provider to a version that declares identity for the type.","Clear stale identity state for the resource if identity is no longer supported.","If developing the provider, register the type in identitySchemas.IdentityTypes."],"exampleFix":"// before\np.identitySchemas.IdentityTypes = map[string]*config.Block{}\n// after\np.identitySchemas.IdentityTypes = map[string]*config.Block{\n    \"aws_example_thing\": identitySchema,\n}","handlingStrategy":"validation","validationCode":"// Before upgrading identity, confirm the type is registered for identity.\nschemas, err := client.GetProviderIdentitySchema(ctx, &tfplugin6.GetProviderIdentitySchema_Request{})\nif err != nil {\n    return err\n}\nif _, ok := schemas.IdentitySchemas[typeName]; !ok {\n    // nothing to upgrade; skip\n    return nil\n}\nreturn client.UpgradeResourceIdentity(ctx, req)","typeGuard":"func identityUpgradeable(s *tfplugin6.GetProviderIdentitySchema_Response, typeName string) bool {\n    _, ok := s.IdentitySchemas[typeName]\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Introspect the identity-schema map before calling UpgradeResourceIdentity.","Clear stale identity state when the provider no longer supports identity for a type."],"tags":["terraform","provider","schema","identity","resource","upgrade","grpc","version-mismatch"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}