{"record":{"id":"5953ce0501d80f6f","repo":"hashicorp/terraform","slug":"no-schema-found-for-s","errorCode":null,"errorMessage":"no schema found for %s","messagePattern":"no schema found for (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/values.go","lineNumber":203,"sourceCode":"\t\tswitch r.Addr.Resource.Resource.Mode {\n\t\tcase addrs.ManagedResourceMode:\n\t\t\tresource.Mode = \"managed\"\n\t\tcase addrs.DataResourceMode:\n\t\t\tresource.Mode = \"data\"\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"resource %s has an unsupported mode %s\",\n\t\t\t\tr.Addr.String(),\n\t\t\t\tr.Addr.Resource.Resource.Mode.String(),\n\t\t\t)\n\t\t}\n\n\t\tschema := schemas.ResourceTypeConfig(\n\t\t\tr.ProviderAddr.Provider,\n\t\t\tr.Addr.Resource.Resource.Mode,\n\t\t\tresource.Type,\n\t\t)\n\t\tif schema.Body == nil {\n\t\t\treturn nil, fmt.Errorf(\"no schema found for %s\", r.Addr.String())\n\t\t}\n\t\tresource.SchemaVersion = uint64(schema.Version)\n\t\tchangeV, err := r.Decode(schema)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// copy the marked After values so we can use these in marshalSensitiveValues\n\t\tmarkedAfter := changeV.After\n\n\t\t// The values may be marked, but we must rely on the Sensitive flag\n\t\t// as the decoded value is only an intermediate step in transcoding\n\t\t// this to a json format.\n\t\tchangeV.Before, _ = changeV.Before.UnmarkDeep()\n\t\tchangeV.After, _ = changeV.After.UnmarkDeep()\n\n\t\tif changeV.After != cty.NilVal {\n\t\t\tif changeV.After.IsWhollyKnown() {","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/values.go#L185-L221","documentation":"Thrown by the JSON plan values builder when the provider schema lookup (schemas.ResourceTypeConfig) returns a schema whose Body is nil for a resource type present in the planned changes. This means the provider advertising the resource type is loaded but does not actually define that resource type's schema, so the change cannot be decoded.","triggerScenarios":"Occurs during JSON plan rendering when a planned change references a resource type (e.g. aws_instance) whose schema.Body is nil after provider schema lookup. Triggered by `terraform show -json <plan>` or `terraform plan -json` when the resource type is absent from the loaded provider's schema.","commonSituations":"Happens when the provider version in the lock file / required_providers does not define the resource type the config uses (e.g. resource renamed/removed in a provider downgrade), when a provider failed to fully initialize, or when using an aliased/wrong provider. Also seen after a `terraform state replace-provider` with incompatible versions.","solutions":["Verify the resource type name is spelled correctly and exists in your provider version (check the provider's docs/changelog).","Upgrade the provider: `terraform init -upgrade` or bump the version in required_providers to one that defines the resource.","Run `terraform providers schema -json` and confirm the resource type appears under the expected provider.","Check for aliased providers (`provider \"aws\" { alias = ... }`) and ensure the resource's provider meta-argument points to a provider that has the type."],"exampleFix":"// before: provider version lacks the resource type\nterraform {\n  required_providers {\n    aws = { source = \"hashicorp/aws\", version = \"~> 3.0\" }\n  }\n}\n// after: bump to a version that defines the resource\nterraform {\n  required_providers {\n    aws = { source = \"hashicorp/aws\", version = \"~> 5.0\" }\n  }\n}","handlingStrategy":"validation","validationCode":"// Before rendering the plan as JSON, ensure every resource type has a provider schema.\nschemas, _ := config.SchemasForProviders(config.ProviderRequirements())\nfor _, r := range plannedChanges {\n    s := schemas.ResourceTypeConfig(r.ProviderAddr.Provider, r.Addr.Resource.Resource.Mode, r.Addr.Resource.Resource.Type)\n    if s.Body == nil {\n        return fmt.Errorf(\"config references %q but the provider has no schema for it\", r.Addr.Resource.Resource.Type)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := jsonplan.MarshalValues(changes, schemas); err != nil {\n    // Most common cause: missing provider schema — guide user to fix required_providers.\n    return err\n}","preventionTips":["Run `terraform providers schema -json` in CI to assert all referenced resource types are defined.","Pin required_providers versions explicitly and run `terraform init` before plan.","Add a check that fails CI if a config references a resource type absent from the provider schema."],"tags":["terraform","jsonplan","provider-schema","version-mismatch","configuration"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}