{"record":{"id":"bee2c5fdad8c541c","repo":"hashicorp/terraform","slug":"error-in-marshaling-output-changes-s","errorCode":null,"errorMessage":"error in marshaling output changes: %s","messagePattern":"error in marshaling output changes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":325,"sourceCode":"\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\n\tif output.OutputChanges, err = MarshalOutputChanges(p.Changes); err != nil {\n\t\treturn nil, fmt.Errorf(\"error in marshaling output changes: %s\", err)\n\t}\n\n\t// output.Checks\n\tif p.Checks != nil && p.Checks.ConfigResults.Len() > 0 {\n\t\toutput.Checks = jsonchecks.MarshalCheckStates(p.Checks)\n\t}\n\n\t// output.PriorState\n\tif sf != nil && !sf.State.Empty() {\n\t\toutput.PriorState, err = jsonstate.Marshal(sf, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error marshaling prior state: %s\", err)\n\t\t}\n\t}\n\n\t// output.Config\n\toutput.Config, err = jsonconfig.Marshal(config, schemas)\n\tif err != nil {","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L307-L343","documentation":"Top-level wrapper: MarshalOutputChanges(p.Changes) failed while building output_changes. The inner error comes from decoding an output change (oc.Decode()) or ctyjson.Marshal of its before/after/afterUnknown/sensitive values.","triggerScenarios":"A root-module output change cannot be decoded or JSON-marshaled. Non-root outputs are skipped, so only root outputs are in play.","commonSituations":"An output value of a cty type ctyjson cannot represent; plan from a different Terraform version; corrupted plan file.","solutions":["Inspect the inner error to identify which output failed.","Simplify or temporarily isolate the problematic output to determine its type.","Regenerate the plan with the current Terraform version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"outputs, err := jsonplan.MarshalOutputChanges(plan.Changes)\nif err != nil {\n    return fmt.Errorf(\"marshal output changes: %w\", err)\n}","preventionTips":["Keep output value types JSON-serializable (avoid deeply recursive/exotic types).","Produce and render plans with the same Terraform version.","Inspect the inner error to find which output value failed."],"tags":["outputs","marshal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}