{"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":"exception","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/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/action_invocations.go#L90-L126","documentation":"Returned by jsonplan.MarshalActionInvocations when MarshalActionInvocation fails for a single action (action_invocations.go:106-109). The %s is the action address and %w wraps the underlying decode error from action.Decode(&schema). The error aborts marshalling of all action invocations and propagates to the caller producing the JSON plan.","triggerScenarios":"Producing JSON plan output (`terraform show -json`) for a plan that contains action invocations whose encoded config cannot be decoded against the action's schema: type mismatches, values failing schema validation, ephemeral marks, or unsupported value marks (see the inner MarshalActionInvocation error branches).","commonSituations":"Provider action schemas changed between plan creation and rendering; corrupted action invocation bytes in the plan; action config carrying marks Terraform can't serialize (ephemeral, custom marks); version skew between the provider that planned the action and the one loaded at show time.","solutions":["Inspect the wrapped error (%w) to find the specific decode failure and address it (e.g. ephemeral config values are unsupported — remove them).","Re-run the plan with a provider version whose action schema matches the rendering terraform build.","Ensure the same provider versions are locked (terraform init / lock file) when planning and when running show -json.","If the action type is unsupported, remove the action from the configuration or upgrade the provider."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure the action type has a schema and the config has no unsupported marks.\nif schemas.ActionTypeConfig(provider, actionType).ConfigSchema == nil {\n    return fmt.Errorf(\"no schema for action %s; run terraform init\", actionType)\n}","typeGuard":null,"tryCatchPattern":"// Skip / report a single bad action without failing the whole marshal.\nout := []ActionInvocation{}\nfor _, a := range actions {\n    ai, err := MarshalActionInvocation(a, schemas)\n    if err != nil { log.Printf(\"skipping action %s: %v\", a.Addr, err); continue }\n    out = append(out, ai)\n}","preventionTips":["Keep provider versions identical when planning and rendering plans.","Avoid ephemeral/unsupported marks in action config values.","Re-plan after upgrading a provider whose action schemas changed."],"tags":["terraform-jsonplan","action","decode","schema","plan"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}