{"record":{"id":"2e2bbae41883e16e","repo":"hashicorp/terraform","slug":"no-resource-identity-schema-found-for-s-in-provi","errorCode":null,"errorMessage":"no resource identity schema found for %s (in provider %s)","messagePattern":"no resource identity schema found for (.+?) \\(in provider (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonstate/state.go","lineNumber":437,"sourceCode":"\t\t\tif ri.Current != nil {\n\t\t\t\tif schema.Version != int64(ri.Current.SchemaVersion) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"schema version %d for %s in state does not match version %d from the provider\", ri.Current.SchemaVersion, resAddr, schema.Version)\n\t\t\t\t}\n\n\t\t\t\tcurrent.SchemaVersion = ri.Current.SchemaVersion\n\n\t\t\t\tif schema.Body == nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"no schema found for %s (in provider %s)\", resAddr.String(), r.ProviderConfig.Provider)\n\t\t\t\t}\n\n\t\t\t\t// Check if we have an identity in the state\n\t\t\t\tif ri.Current.IdentityJSON != nil {\n\t\t\t\t\tif schema.IdentityVersion != int64(ri.Current.IdentitySchemaVersion) {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"resource identity schema version %d for %s in state does not match version %d from the provider\", ri.Current.IdentitySchemaVersion, resAddr, schema.IdentityVersion)\n\t\t\t\t\t}\n\n\t\t\t\t\tif schema.Identity == nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"no resource identity schema found for %s (in provider %s)\", resAddr.String(), r.ProviderConfig.Provider)\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent.IdentitySchemaVersion = &ri.Current.IdentitySchemaVersion\n\t\t\t\t}\n\n\t\t\t\triObj, err := ri.Current.Decode(schema)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tvar value cty.Value\n\t\t\t\tvar sensitivePaths []cty.Path\n\t\t\t\tvalue, current.AttributeValues, sensitivePaths, err = marshalAttributeValues(riObj.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"preparing attribute values for %s: %w\", current.Address, err)\n\t\t\t\t}\n\t\t\t\tsensitivePaths = append(sensitivePaths, schema.Body.SensitivePaths(value, nil)...)\n\t\t\t\ts := SensitiveAsBool(marks.MarkPaths(value, marks.Sensitive, sensitivePaths))","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonstate/state.go#L419-L455","documentation":"Thrown when a resource instance stores identity JSON in state but the loaded provider's schema has no identity schema (schema.Identity == nil) for that resource type. The provider is loaded and defines the resource, but it does not define an identity schema, so the stored identity blob cannot be decoded or validated.","triggerScenarios":"Occurs in jsonstate when ri.Current.IdentityJSON != nil and schema.Identity == nil. Triggered when state contains identity data (written by a provider version that supported resource identity) but the currently-loaded provider version does not define an identity schema for the type.","commonSituations":"Downgrading a provider from a version with identity support to one without, or using a community/fork provider that omits identity schemas. Also possible if the state was written by a newer Terraform/provider combo and the environment was rolled back.","solutions":["Upgrade the provider to a version that defines resource identity schemas for that type and run `terraform init`.","Confirm via `terraform providers schema -json` that the provider's resource type has an `identity` block.","If identity support was deliberately removed, re-apply with the original provider version to clear the stored identity, then switch.","As a last resort, `terraform state rm` and re-import the resource to drop the legacy identity data."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before serializing state as JSON, ensure the provider defines an identity schema where state has identity data.\nfor _, r := range state.Resources {\n    if r.Current == nil || r.Current.IdentityJSON == nil { continue }\n    s := schemas.ResourceTypeConfig(r.ProviderConfig.Provider, r.Addr.Mode, r.Addr.Type)\n    if s.Identity == nil {\n        return fmt.Errorf(\"state has identity for %s but provider %s defines no identity schema\", r.Addr, r.ProviderConfig.Provider)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := jsonstate.MarshalState(state, schemas); err != nil {\n    // No identity schema in provider: upgrade the provider or clear legacy identity data.\n    return err\n}","preventionTips":["Do not downgrade providers below the version that wrote identity data.","Verify identity schema presence via `terraform providers schema -json` after init.","When removing identity support intentionally, re-apply first to clear stored identity."],"tags":["terraform","jsonstate","identity-schema","provider-schema","version-mismatch"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}