{"record":{"id":"72565528fee45747","repo":"hashicorp/terraform","slug":"error-in-marshaling-deferred-action-invocations","errorCode":null,"errorMessage":"error in marshaling deferred action invocations: %s","messagePattern":"error in marshaling deferred action invocations: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":319,"sourceCode":"\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\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)","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L301-L337","documentation":"Top-level wrapper: serializing deferred action invocations (p.DeferredActionInvocations) via MarshalDeferredActionInvocations failed. Each deferred invocation is marshaled with MarshalActionInvocation, so the inner error is one of 600-603.","triggerScenarios":"p.DeferredActionInvocations != nil and one deferred action invocation fails to decode or has unsupported marks/trigger type. Reached when planning produces deferred actions.","commonSituations":"Deferred actions whose config contains ephemeral values (602); schema mismatch for the action (600); version skew introducing new marks (603) or trigger types (601).","solutions":["Inspect the inner error (600-603) for the specific action and cause.","Remove ephemeral/unsupported references from the action config.","Regenerate the plan with consistent Terraform/provider versions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"deferred, err := jsonplan.MarshalDeferredActionInvocations(plan.DeferredActionInvocations, schemas)\nif err != nil {\n    // inner error is one of 600-603; unwrap to identify the action\n    return fmt.Errorf(\"marshal deferred actions: %w\", err)\n}","preventionTips":["Do not put ephemeral values into deferred action config (602).","Keep plan-producer and renderer versions consistent.","Re-run planning after fixing action config so deferrals recompute."],"tags":["deferred","actions","marshal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}