{"record":{"id":"63443c5fe9bb71d1","repo":"hashicorp/terraform","slug":"the-builtin-provider-does-not-support-provider-upg","errorCode":null,"errorMessage":"The builtin provider does not support provider upgrades since it has not changed the identity schema yet.","messagePattern":"The builtin provider does not support provider upgrades since it has not changed the identity schema yet\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/builtin/providers/terraform/resource_data.go","lineNumber":109,"sourceCode":"\t}\n\treturn resp\n}\n\nfunc upgradeDataStoreResourceState(req providers.UpgradeResourceStateRequest) (resp providers.UpgradeResourceStateResponse) {\n\t// We've only added new nullable block attributes, so unmarshaling from json\n\t// will complete the data structure correctly.\n\tval, err := ctyjson.Unmarshal(req.RawStateJSON, dataStoreResourceSchema().Body.ImpliedType())\n\tif err != nil {\n\t\tresp.Diagnostics = resp.Diagnostics.Append(err)\n\t\treturn resp\n\t}\n\n\tresp.UpgradedState = val\n\treturn resp\n}\n\nfunc upgradeDataStoreResourceIdentity(providers.UpgradeResourceIdentityRequest) (resp providers.UpgradeResourceIdentityResponse) {\n\tresp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf(\"The builtin provider does not support provider upgrades since it has not changed the identity schema yet.\"))\n\treturn resp\n}\n\nfunc readDataStoreResourceState(req providers.ReadResourceRequest) (resp providers.ReadResourceResponse) {\n\tresp.NewState = req.PriorState\n\tresp.Private = req.Private\n\treturn resp\n}\n\nfunc planDataStoreResourceChange(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {\n\tresp.PlannedState = req.ProposedNewState\n\n\tif req.ProposedNewState.IsNull() {\n\t\t// destroy op\n\t\treturn resp\n\t}\n\n\tplanned := req.ProposedNewState.AsValueMap()","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/builtin/providers/terraform/resource_data.go#L91-L127","documentation":"The terraform_data resource's identity schema version is 0 and has never changed, so UpgradeResourceIdentity unconditionally returns an error. Terraform Core should never call this method because the schema version matches; receiving this error means Core's upgrade path was triggered against a resource whose identity schema version is somehow below the current version, which is impossible with this provider.","triggerScenarios":"Calling upgradeDataStoreResourceIdentity (resource_data.go:108-111). The method has no conditional logic and always returns the error. This can only happen if Terraform Core's state migration logic invokes the identity upgrade path for a terraform_data resource instance whose stored identity schema version is less than 0.","commonSituations":"Manually editing state file to set a non-zero or future identity schema version. Running a development or custom build of Terraform that has bumped the identity schema version without updating the upgrade function. State file corruption causing an unexpected version mismatch.","solutions":["If you manually edited the state file, revert the identity schema version to 0 for terraform_data resources.","If this is a development build, update upgradeDataStoreResourceIdentity to handle the new version or bump the IdentitySchema Version field accordingly.","Run 'terraform refresh' after restoring a known-good state backup to resynchronize."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before calling UpgradeResourceIdentity, check the schema version\nidentitySchemas := provider.GetResourceIdentitySchemas()\nif schema, ok := identitySchemas.IdentityTypes[\"terraform_data\"]; ok && schema.Version == 0 {\n    // No upgrade needed; current version is 0\n    return providers.UpgradeResourceIdentityResponse{}\n}","typeGuard":null,"tryCatchPattern":"// Wrap identity upgrade in a recovery to handle the unconditional error\ndefer func() {\n    if r := recover(); r != nil {\n        // log and continue with original identity\n    }\n}()\nresp := provider.UpgradeResourceIdentity(req)\nif resp.Diagnostics.HasErrors() {\n    // identity schema version is 0; no upgrade possible, use original\n    log.Printf(\"[WARN] identity upgrade not supported, using original state\")\n}","preventionTips":["Do not manually edit the identity schema version in state files for terraform_data resources.","If upgrading the identity schema in a fork, update the Version field and implement the upgrade function together.","Keep state file backups before running operations that trigger identity upgrades."],"tags":["terraform","terraform-data","identity-schema","state-upgrade","go"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}