{"record":{"id":"77eda3f84d904301","repo":"hashicorp/terraform","slug":"error-marshaling-config-s","errorCode":null,"errorMessage":"error marshaling config: %s","messagePattern":"error marshaling config: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":344,"sourceCode":"\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)\n\t\t}\n\t}\n\n\t// output.Config\n\toutput.Config, err = jsonconfig.Marshal(config, schemas)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling config: %s\", err)\n\t}\n\n\t// output.Changes.ActionInvocations\n\tif p.Changes.ActionInvocations != nil {\n\t\tif output.ActionInvocations, err = MarshalActionInvocations(p.Changes.ActionInvocations, schemas); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error marshaling action invocations: %s\", err)\n\t\t}\n\t}\n\n\treturn json.Marshal(output)\n}\n\nfunc (p *plan) marshalPlanVariables(vars map[string]plans.DynamicValue, decls map[string]*configs.Variable) error {\n\tp.Variables = make(variables, len(vars))\n\n\tfor k, v := range vars {\n\t\tval, err := v.Decode(cty.DynamicPseudoType)\n\t\tif err != nil {","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L326-L362","documentation":"Top-level wrapper: jsonconfig.Marshal(config, schemas) failed while building the configuration section. Config serialization needs provider/module schemas to interpret the HCL, so failures usually stem from a missing schema.","triggerScenarios":"Reached on every full Marshal call. Config marshaling fails when a provider or module schema needed to decode a config block is unavailable or incompatible.","commonSituations":"Provider not initialized (terraform init not run); module source/version changed since the plan was made; provider version downgrade removing a schema; corrupt configuration.","solutions":["Run `terraform init` to install providers and modules.","Verify module and provider version pins match what produced the plan.","Regenerate the plan after `terraform init` succeeds cleanly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := jsonplan.Marshal(config, plan, sf, schemas)\nif err != nil && strings.Contains(err.Error(), \"marshaling config\") {\n    // provider/module schema missing; run terraform init\n}\nreturn err","preventionTips":["Always run `terraform init` before rendering so config schemas are available.","Pin module and provider versions and keep them consistent between plan and render.","Regenerate plans after changing module sources or versions."],"tags":["config","marshal","provider"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}