{"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/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/jsonplan/plan.go#L326-L362","documentation":"Top-level propagation error from Marshal: jsonconfig.Marshal failed while rendering the configuration snapshot embedded in the plan JSON. The wrapped error comes from the config marshaller and usually indicates a schema lookup or decode problem for a configured resource.","triggerScenarios":"A resource/data source in the config references a provider schema that is missing or incompatible, or a config block fails to decode against the provider schema.","commonSituations":"Provider not initialized; provider version in lock file predates a resource type used in config; cross-version rendering.","solutions":["Read the wrapped error for the failing config block/resource type.","Run `terraform init` to ensure providers and schemas are present.","Update the provider lock file to a version that defines the resource type.","Regenerate the plan after init."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm each configured resource/data source has a schema before marshaling config.\nfunc configSchemasOk(cfg *configs.Config, schemas *terraform.Schemas) error {\n    for _, r := range cfg.Module.ManagedResources {\n        s := schemas.ResourceTypeConfig(r.ProviderConfigAddr(), addrs.ManagedResourceMode, r.Type) // simplified\n        if s.Body == nil {\n            return fmt.Errorf(\"resource %%s has no schema\", r.Addr())\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `terraform init` to load all provider schemas referenced by config.","Update .terraform.lock.hcl when adopting new resource types."],"tags":["go","terraform","plan","config","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"}