{"record":{"id":"d71ca8eb8af061c4","repo":"hashicorp/terraform","slug":"error-in-marshaling-resource-changes-s","errorCode":null,"errorMessage":"error in marshaling resource changes: %s","messagePattern":"error in marshaling resource changes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":305,"sourceCode":"\t\t\t\t\tdriftedResources = append(driftedResources, dr)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.ResourceDrift, err = MarshalResourceChanges(driftedResources, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in marshaling resource drift: %s\", err)\n\t\t}\n\t}\n\n\tif err := output.marshalRelevantAttrs(p); err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling relevant attributes for external changes: %s\", err)\n\t}\n\n\t// output.ResourceChanges\n\tif p.Changes != nil {\n\t\toutput.ResourceChanges, err = MarshalResourceChanges(p.Changes.Resources, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in marshaling resource changes: %s\", err)\n\t\t}\n\t}\n\n\tif p.DeferredResources != nil {\n\t\toutput.DeferredChanges, err = MarshalDeferredResourceChanges(p.DeferredResources, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in marshaling deferred resource changes: %s\", err)\n\t\t}\n\t}\n\n\tif p.DeferredActionInvocations != nil {\n\t\toutput.DeferredActionInvocations, err = MarshalDeferredActionInvocations(p.DeferredActionInvocations, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in marshaling deferred action invocations: %s\", err)\n\t\t}\n\t}\n\n\t// output.OutputChanges","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L287-L323","documentation":"Top-level wrapper: serializing the primary resource_changes list via MarshalResourceChanges(p.Changes.Resources, ...) failed. The inner error usually comes from marshalResourceChange and surfaces as 615 (no schema), 616 (unsupported mode), 617 (unsupported action reason), or a decode/ctyjson error.","triggerScenarios":"Reached on every full Marshal call when p.Changes != nil. Any planned resource change that fails to marshal aborts the whole render and is wrapped here.","commonSituations":"Missing provider schema for a planned resource; provider version mismatch; a resource mode/action reason from a newer Terraform; corrupted plan or state.","solutions":["Read the inner error to find the offending resource address and specific cause.","Run `terraform init` to install/pin the correct provider versions.","Regenerate the plan with a Terraform version consistent with the state."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"changes, err := jsonplan.MarshalResourceChanges(plan.Changes.Resources, schemas)\nif err != nil {\n    // the inner error names the offending resource; surface it to the user\n    return fmt.Errorf(\"marshal resource changes: %w\", err)\n}","preventionTips":["Install and pin all providers with `terraform init` before rendering.","Match provider versions between plan creation and rendering.","Treat a 'no schema found' inner error as a missing/mismatched provider."],"tags":["resource-changes","marshal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}