{"record":{"id":"fae6b5bbc1df4cf7","repo":"hashicorp/terraform","slug":"error-marshaling-relevant-attributes-for-external","errorCode":null,"errorMessage":"error marshaling relevant attributes for external changes: %s","messagePattern":"error marshaling relevant attributes for external changes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/jsonplan/plan.go","lineNumber":298,"sourceCode":"\t\t// we skip them here.\n\t\tvar driftedResources []*plans.ResourceInstanceChangeSrc\n\t\tif p.UIMode == plans.RefreshOnlyMode {\n\t\t\tdriftedResources = p.DriftedResources\n\t\t} else {\n\t\t\tfor _, dr := range p.DriftedResources {\n\t\t\t\tif dr.Action != plans.NoOp {\n\t\t\t\t\tdriftedResources = append(driftedResources, dr)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toutput.ResourceDrift, err = MarshalResourceChanges(driftedResources, schemas)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in marshaling resource drift: %s\", err)\n\t\t}\n\t}\n\n\tif err := output.marshalRelevantAttrs(p); err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling relevant attributes for external changes: %s\", err)\n\t}\n\n\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 {","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/jsonplan/plan.go#L280-L316","documentation":"Top-level wrapper: output.marshalRelevantAttrs failed. That function encodes each RelevantAttributes entry's cty.Path via encodePath; a failure means a path step could not be JSON-encoded (typically surfacing errors 618 or 619).","triggerScenarios":"plan.RelevantAttributes contains an entry whose path has an unsupported step type or an index key/attribute name that cannot marshal. Reached on every full Marshal call when relevant attributes exist.","commonSituations":"Rare. Usually tied to a path-encoding bug or an exotic value type used as an index key in a cross-resource reference; can follow internal changes to how relevant attributes are recorded.","solutions":["Inspect the inner error (often 618/619) to see which step/key failed.","Report as a renderer bug if it occurs on a common attribute type.","As a workaround, isolate the configuration/reference that produces the problematic attribute path and avoid it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := jsonplan.Marshal(config, plan, sf, schemas)\nif err != nil {\n    // inner error is usually a path-step marshal failure (618/619);\n    // capture it for diagnostics rather than ignoring.\n    return err\n}","preventionTips":["Report path-encoding failures with the full path so the offending step is identifiable.","Avoid configurations that build relevant-attribute paths through exotic key types."],"tags":["relevant-attributes","paths","marshal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}