{"record":{"id":"bc700fd317a3ec59","repo":"opentofu/opentofu","slug":"invalid-deposed-key-in-element-d-w","errorCode":null,"errorMessage":"invalid deposed key in element %d: %w","messagePattern":"invalid deposed key in element (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/engine/internal/execgraph/graph_unmarshal.go","lineNumber":87,"sourceCode":"\n\t\tcase execgraphproto.Element_ConstantValue_case:\n\t\t\tval, err := unmarshalConstantValueElem(elem.GetConstantValue())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid constant value in element %d: %w\", idx, err)\n\t\t\t}\n\t\t\tresults[idx] = builder.ConstantValue(val)\n\n\t\tcase execgraphproto.Element_ConstantResourceInstAddr_case:\n\t\t\taddr, err := unmarshalConstantResourceInstAddr(elem.GetConstantResourceInstAddr())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid resource instance address in element %d: %w\", idx, err)\n\t\t\t}\n\t\t\tresults[idx] = builder.ConstantResourceInstAddr(addr)\n\n\t\tcase execgraphproto.Element_DeposedKey_case:\n\t\t\tkey, err := unmarshalConstantDeposedKey(elem.GetDeposedKey())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid deposed key in element %d: %w\", idx, err)\n\t\t\t}\n\t\t\tresults[idx] = builder.ConstantDeposedKey(key)\n\n\t\tcase execgraphproto.Element_ConstantProviderInstAddr_case:\n\t\t\taddr, err := unmarshalConstantProviderInstAddr(elem.GetConstantProviderInstAddr())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid provider instance address in element %d: %w\", idx, err)\n\t\t\t}\n\t\t\tresults[idx] = builder.ConstantProviderInstAddr(addr)\n\n\t\tdefault:\n\t\t\t// The above cases should cover all of the valid values of\n\t\t\t// execgraphproto.case_Element_Request, so we should not get here\n\t\t\t// for any serialized graph that was produced by this version\n\t\t\t// of OpenTofu.\n\t\t\treturn nil, fmt.Errorf(\"unrecognized request type %#v for element %d\", reqType, idx)\n\t\t}\n\t}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/opentofu/opentofu/blob/3561785c48c1ce615e7c50261bd351f26053efa2/internal/engine/internal/execgraph/graph_unmarshal.go#L69-L105","documentation":"The DeposedKey element at index N failed to decode: the stored deposed key string is not a valid addrs.DeposedKey (deposed keys have a fixed expected format). The wrapped error identifies exactly why the key is invalid.","triggerScenarios":"A deposed key in the serialized graph is empty or not in the canonical 12-hex-digit-like DeposedKey format, from corruption or an incompatible producer.","commonSituations":"Hand-edited or truncated graph artifacts; cross-version artifacts written by code with different key validation rules.","solutions":["Regenerate the serialized graph from a fresh run","Use matching OpenTofu versions on both ends of the exchange","File an issue with the artifact if same-version Marshal/Unmarshal round-trip fails"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"g, err := execgraph.UnmarshalGraph(src)\nif err != nil && strings.Contains(err.Error(), \"invalid deposed key in element\") {\n\treturn fmt.Errorf(\"serialized graph contains an invalid deposed key: %w\", err)\n}","preventionTips":["Keep graph producer and consumer on the same OpenTofu release","Do not modify deposed-key entries in serialized artifacts","Regenerate graphs from fresh successful runs instead of patching bytes"],"tags":["protobuf","graph","engine","deposed-key","deserialization"],"backgroundTag":null,"analyzedSha":"3561785c48c1ce615e7c50261bd351f26053efa2","analyzedAt":"2026-08-15T23:27:16.226Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}