{"record":{"id":"e294f9415e641b46","repo":"hashicorp/terraform","slug":"no-schema-found-for-s-in-provider-s-e294f9","errorCode":null,"errorMessage":"no schema found for %s (in provider %s)","messagePattern":"no schema found for (.+?) \\(in provider (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonstate/state.go","lineNumber":427,"sourceCode":"\t\t\t\t)\n\t\t\t}\n\n\t\t\tschema := schemas.ResourceTypeConfig(\n\t\t\t\tr.ProviderConfig.Provider,\n\t\t\t\tresAddr.Mode,\n\t\t\t\tresAddr.Type,\n\t\t\t)\n\n\t\t\t// It is possible that the only instance is deposed\n\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","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonstate/state.go#L409-L445","documentation":"Thrown by the JSON state serializer when the provider schema lookup returns a nil Body for a resource type that exists in state. The provider is loaded but does not define a schema for that resource type, so the stored object cannot be decoded. Equivalent of error 622 but for state serialization.","triggerScenarios":"Occurs in jsonstate when schema.Body == nil after ResourceTypeConfig lookup for a resource type present in ri.Current. Triggered by any JSON state rendering when the loaded provider no longer ships the resource type stored in state.","commonSituations":"The resource type was removed or renamed in the installed provider version (e.g. provider dropped a deprecated resource). Also happens with aliased/misconfigured providers or after a `terraform state replace-provider` to a provider that lacks the type.","solutions":["Check the provider's changelog for the resource type's removal/rename and use the version that still defines it.","Run `terraform providers schema -json` to confirm which provider/version defines the type.","Pin required_providers to a version that includes the resource type and run `terraform init`.","If the resource is gone for good, `terraform state rm` it (and re-create/import with the replacement type if one exists)."],"exampleFix":"// before: provider version that removed the resource\nterraform {\n  required_providers {\n    kubernetes = { source = \"hashicorp/kubernetes\", version = \"~> 2.20\" }\n  }\n}\n// after: pin to a version that still defines the resource type in state\nterraform {\n  required_providers {\n    kubernetes = { source = \"hashicorp/kubernetes\", version = \"= 2.10.0\" }\n  }\n}","handlingStrategy":"validation","validationCode":"// Before serializing state as JSON, ensure each resource type is defined by its provider.\nfor _, r := range state.Resources {\n    s := schemas.ResourceTypeConfig(r.ProviderConfig.Provider, r.Addr.Mode, r.Addr.Type)\n    if r.Current != nil && s.Body == nil {\n        return fmt.Errorf(\"provider %s has no schema for %s — pin a provider version that defines it\", r.ProviderConfig.Provider, r.Addr.Type)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := jsonstate.MarshalState(state, schemas); err != nil {\n    // Missing schema: instruct user to install a provider version that defines the type.\n    return err\n}","preventionTips":["Run `terraform providers schema -json` after `terraform init` to confirm all state resource types are present.","Pin provider versions so a type cannot silently disappear on upgrade.","Coordinate provider downgrades with state cleanup (state rm / re-import)."],"tags":["terraform","jsonstate","provider-schema","state","version-mismatch"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}