{"record":{"id":"afcc5a4e95522502","repo":"hashicorp/terraform","slug":"preparing-identity-values-for-s-w","errorCode":null,"errorMessage":"preparing identity values for %s: %w","messagePattern":"preparing identity values for (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonstate/state.go","lineNumber":464,"sourceCode":"\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))\n\t\t\t\tv, err := ctyjson.Marshal(s, s.Type())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcurrent.SensitiveValues = v\n\n\t\t\t\tcurrent.IdentityValues, err = marshalIdentityValues(riObj.Identity)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"preparing identity values for %s: %w\", current.Address, err)\n\t\t\t\t}\n\n\t\t\t\tif len(riObj.Dependencies) > 0 {\n\t\t\t\t\tdependencies := make([]string, len(riObj.Dependencies))\n\t\t\t\t\tfor i, v := range riObj.Dependencies {\n\t\t\t\t\t\tdependencies[i] = v.String()\n\t\t\t\t\t}\n\t\t\t\t\tcurrent.DependsOn = dependencies\n\t\t\t\t}\n\n\t\t\t\tif riObj.Status == states.ObjectTainted {\n\t\t\t\t\tcurrent.Tainted = true\n\t\t\t\t}\n\t\t\t\tret = append(ret, current)\n\t\t\t}\n\n\t\t\tfor _, deposedKey := range slices.Sorted(maps.Keys(ri.Deposed)) {\n\t\t\t\trios := ri.Deposed[states.DeposedKey(deposedKey)]","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonstate/state.go#L446-L482","documentation":"Wraps an error from marshalIdentityValues while serializing the current (non-deposed) resource instance's identity blob in state. The %w carries the underlying cause; the resource address is included so the failing instance can be identified. This is the identity counterpart of error 628.","triggerScenarios":"Raised in jsonstate when marshalIdentityValues(riObj.Identity) returns a non-nil error for the current instance. Triggered during JSON state rendering when a resource has identity data (ri.Current.IdentityJSON != nil) that fails to marshal/decode.","commonSituations":"Occurs when the identity value in state is malformed, has an unsupported cty mark, or the identity schema has changed shape. Often accompanies provider/identity schema migrations that did not run cleanly.","solutions":["Inspect the wrapped (%w) inner error to find the true serialization cause.","Re-apply with the current provider so the identity blob is rewritten under the current schema.","Upgrade Terraform Core and provider to versions with stable identity schema support.","If unrecoverable, remove the resource from state and re-import to regenerate its identity data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := jsonstate.MarshalIdentity(riObj.Identity); err != nil {\n    // Wrapped identity error — re-apply to rewrite identity under the current schema.\n    return err\n}","preventionTips":["Re-apply after identity schema changes to keep identity blobs serializable.","Inspect the wrapped (%w) cause before escalating.","Pin provider versions during identity feature rollouts."],"tags":["terraform","jsonstate","identity","serialization","wrapped-error"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}