{"record":{"id":"38f8f098a5fab6f5","repo":"hashicorp/terraform","slug":"failed-to-decode-action-s-w","errorCode":null,"errorMessage":"failed to decode action %s: %w","messagePattern":"failed to decode action (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/action_invocations.go","lineNumber":108,"sourceCode":"\t\t}\n\n\t\tif latA.ActionsListIndex < latB.ActionsListIndex {\n\t\t\treturn -1\n\n\t\t} else if latA.ActionsListIndex > latB.ActionsListIndex {\n\t\t\treturn 1\n\t\t}\n\t}\n\n\treturn 0\n}\n\nfunc MarshalActionInvocations(actions []*plans.ActionInvocationInstanceSrc, schemas *terraform.Schemas) ([]ActionInvocation, error) {\n\tret := make([]ActionInvocation, 0, len(actions))\n\tfor _, action := range actions {\n\t\tai, err := MarshalActionInvocation(action, schemas)\n\t\tif err != nil {\n\t\t\treturn ret, fmt.Errorf(\"failed to decode action %s: %w\", action.Addr, err)\n\t\t}\n\t\tret = append(ret, ai)\n\t}\n\treturn ret, nil\n}\n\nfunc MarshalActionInvocation(action *plans.ActionInvocationInstanceSrc, schemas *terraform.Schemas) (ActionInvocation, error) {\n\tai := ActionInvocation{\n\t\tAddress:      action.Addr.String(),\n\t\tType:         action.Addr.Action.Action.Type,\n\t\tName:         action.Addr.Action.Action.Name,\n\t\tProviderName: action.ProviderAddr.Provider.String(),\n\t}\n\tschema := schemas.ActionTypeConfig(\n\t\taction.ProviderAddr.Provider,\n\t\taction.Addr.Action.Action.Type,\n\t)\n\tif schema.ConfigSchema == nil {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/jsonplan/action_invocations.go#L90-L126","documentation":"Wrapper error from MarshalActionInvocations: it iterates action invocation instances and re-wraps any per-action failure returned by MarshalActionInvocation. The message identifies which action (by Addr) failed and chains the underlying error with %w.","triggerScenarios":"Any failure inside MarshalActionInvocation for a single action propagates here: missing schema (603), decode failure (604), unsupported trigger type (605), ephemeral marks (606), or unsupported marks (607).","commonSituations":"Plan contains action invocations whose provider schema is stale, whose action trigger type is unrecognized by this Terraform version, or whose config carries marks this version cannot serialize.","solutions":["Read the chained %w error first — it names the actual cause (603/604/605/606/607).","Re-init the provider (`terraform init -upgrade`) so the action type schema is present.","Upgrade Terraform to a version that supports the action trigger type or marks involved.","If the plan was produced by a newer Terraform, regenerate it with the current version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := MarshalActionInvocations(actions, schemas)\nif err != nil {\n    // err already chains the per-action cause via %%w; unwrap to branch on it\n    return fmt.Errorf(\"cannot render action invocations: %%w\", err)\n}","preventionTips":["Treat the wrapped error as authoritative — it names the real per-action failure.","Validate all providers/action types are initialized before marshaling.","Use consistent Terraform and provider versions for plan creation and rendering."],"tags":["go","terraform","plan","actions","error-wrapping","jsonplan"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}