hashicorp/terraform · error

error marshaling action invocations: %s

Error message

error marshaling action invocations: %s

What it means

Top-level wrapper: MarshalActionInvocations(p.Changes.ActionInvocations, schemas) failed. Each invocation is marshaled individually, so the inner error is one of 600-603 (decode failure, unsupported trigger type, ephemeral config, or unsupported marks).

Source

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

	// 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 {
		return nil, fmt.Errorf("error marshaling config: %s", err)
	}

	// output.Changes.ActionInvocations
	if p.Changes.ActionInvocations != nil {
		if output.ActionInvocations, err = MarshalActionInvocations(p.Changes.ActionInvocations, schemas); err != nil {
			return nil, fmt.Errorf("error marshaling action invocations: %s", err)
		}
	}

	return json.Marshal(output)
}

func (p *plan) marshalPlanVariables(vars map[string]plans.DynamicValue, decls map[string]*configs.Variable) error {
	p.Variables = make(variables, len(vars))

	for k, v := range vars {
		val, err := v.Decode(cty.DynamicPseudoType)
		if err != nil {
			return err
		}
		valJSON, err := ctyjson.Marshal(val, val.Type())
		if err != nil {
			return err
		}

View on GitHub (pinned to c9def3e214)

Solutions

  1. Inspect the inner error (600-603) to find the failing action address.
  2. Fix the action config (remove ephemeral/unsupported references).
  3. Regenerate the plan with matching Terraform and provider versions.
Defensive patterns

Strategy: try-catch

Try / catch

invocations, err := jsonplan.MarshalActionInvocations(plan.Changes.ActionInvocations, schemas)
if err != nil {
    // inner error (600-603) names the failing action; surface it
    return fmt.Errorf("marshal action invocations: %w", err)
}

Prevention

When it happens

Trigger: p.Changes.ActionInvocations != nil and at least one invocation fails to marshal. Reached on every full Marshal call that includes planned actions.

Common situations: An action config containing ephemeral values (602); action schema mismatch between plan and render (600); version skew introducing new marks (603) or trigger types (601).

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/0a80e05e36b747b4. Report an issue: GitHub.