{"record":{"id":"d4f5e7c6b3c5743c","repo":"hashicorp/terraform","slug":"error-in-marshalplannedvalues-s","errorCode":null,"errorMessage":"error in marshalPlannedValues: %s","messagePattern":"error in marshalPlannedValues: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":272,"sourceCode":"\tsf *statefile.File,\n\tschemas *terraform.Schemas,\n) ([]byte, error) {\n\toutput := newPlan()\n\toutput.TerraformVersion = version.String()\n\toutput.Timestamp = p.Timestamp.Format(time.RFC3339)\n\toutput.Applyable = p.Applyable\n\toutput.Complete = p.Complete\n\toutput.Errored = p.Errored\n\n\terr := output.marshalPlanVariables(p.VariableValues, config.Module.Variables)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in marshalPlanVariables: %s\", err)\n\t}\n\n\t// output.PlannedValues\n\terr = output.marshalPlannedValues(p.Changes, schemas)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error in marshalPlannedValues: %s\", err)\n\t}\n\n\t// output.ResourceDrift\n\tif len(p.DriftedResources) > 0 {\n\t\t// In refresh-only mode, we render all resources marked as drifted,\n\t\t// including those which have moved without other changes. In other plan\n\t\t// modes, move-only changes will be included in the planned changes, so\n\t\t// we skip them here.\n\t\tvar driftedResources []*plans.ResourceInstanceChangeSrc\n\t\tif p.UIMode == plans.RefreshOnlyMode {\n\t\t\tdriftedResources = p.DriftedResources\n\t\t} else {\n\t\t\tfor _, dr := range p.DriftedResources {\n\t\t\t\tif dr.Action != plans.NoOp {\n\t\t\t\t\tdriftedResources = append(driftedResources, dr)\n\t\t\t\t}\n\t\t\t}\n\t\t}","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L254-L290","documentation":"Top-level wrapper: output.marshalPlannedValues failed while building planned_values (root module resources plus outputs). The inner error bubbles up from marshaling a planned resource change or a planned output.","triggerScenarios":"Reached on every full Marshal call. Any sub-marshal of a planned resource or output fails (schema missing, decode error, ctyjson error) and is wrapped by this message.","commonSituations":"Provider schema problems for a planned resource; corrupted plan; version mismatch between the plan producer and renderer; an output value of a non-JSON-representable type.","solutions":["Read the wrapped inner error to identify the offending resource or output address.","Ensure provider versions match between plan and render (terraform init).","Regenerate the plan from scratch."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := jsonplan.Marshal(config, plan, sf, schemas)\nif err != nil {\n    // unwrap to find the planned resource/output that failed\n    return fmt.Errorf(\"render plan: %w\", err)\n}","preventionTips":["Keep provider versions aligned between plan creation and rendering.","Run `terraform init` so all resource schemas load before rendering.","Re-generate plans after provider/Terraform upgrades."],"tags":["planned-values","marshal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}