hashicorp/terraform · error

error in marshaling output changes

Error message

error in marshaling output changes: %s

What it means

Top-level propagation error from Marshal: MarshalOutputChanges failed while rendering the planned changes to output values. The wrapped error names the failing output.

Solutions

  1. Read the wrapped error for the specific output name.
  2. Regenerate the plan with the current config so output types match.
  3. Ensure consistent Terraform/provider versions between plan and render.
  4. Check recently edited outputs in the configuration.
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := MarshalOutputChanges(p.Changes); err != nil {
    return fmt.Errorf("output changes render failed: %%w", err)
}

Prevention

When it happens

Trigger: An output change cannot be decoded or marshaled — typically because the output value's type drifted, or it carries marks/unknowns the renderer cannot serialize.

Common situations: Output type changed in config after planning; cross-version plan rendering; outputs derived from resources whose schemas changed.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/bee2c5fdad8c541c. Report an issue: GitHub.

Appendix: source

Thrown at internal/command/jsonplan/plan.go:325

	}

	if p.DeferredResources != nil {
		output.DeferredChanges, err = MarshalDeferredResourceChanges(p.DeferredResources, schemas)
		if err != nil {
			return nil, fmt.Errorf("error in marshaling deferred resource changes: %s", err)
		}
	}

	if p.DeferredActionInvocations != nil {
		output.DeferredActionInvocations, err = MarshalDeferredActionInvocations(p.DeferredActionInvocations, schemas)
		if err != nil {
			return nil, fmt.Errorf("error in marshaling deferred action invocations: %s", err)
		}
	}

	// output.OutputChanges
	if output.OutputChanges, err = MarshalOutputChanges(p.Changes); err != nil {
		return nil, fmt.Errorf("error in marshaling output changes: %s", err)
	}

	// output.Checks
	if p.Checks != nil && p.Checks.ConfigResults.Len() > 0 {
		output.Checks = jsonchecks.MarshalCheckStates(p.Checks)
	}

	// output.PriorState
	if sf != nil && !sf.State.Empty() {
		output.PriorState, err = jsonstate.Marshal(sf, schemas)
		if err != nil {
			return nil, fmt.Errorf("error marshaling prior state: %s", err)
		}
	}

	// output.Config
	output.Config, err = jsonconfig.Marshal(config, schemas)
	if err != nil {

View on GitHub (pinned to d32a084675)