{"record":{"id":"a670b944fe6c4917","repo":"opentofu/opentofu","slug":"invalid-opmanagedperformdepose-currentobj-w","errorCode":null,"errorMessage":"invalid opManagedPerformDepose currentObj: %w","messagePattern":"invalid opManagedPerformDepose currentObj: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/engine/internal/execgraph/graph_unmarshal.go","lineNumber":254,"sourceCode":"\t}\n\tdeletePlan, err := unmarshalGetPrevResultOf[*exec.ManagedResourceObjectFinalPlan](prevResults, rawOperands[0])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid opManagedPrepareDepose deletePlan: %w\", err)\n\t}\n\tdeposedKey, err := unmarshalGetPrevResultOf[addrs.DeposedKey](prevResults, rawOperands[1])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid opManagedPrepareDepose deposedKey: %w\", err)\n\t}\n\treturn builder.ManagedPrepareDepose(deletePlan, deposedKey), nil\n}\n\nfunc unmarshalOpManagedPerformDepose(rawOperands []uint64, prevResults []AnyResultRef, builder *Builder) (AnyResultRef, error) {\n\tif len(rawOperands) != 3 {\n\t\treturn nil, fmt.Errorf(\"wrong number of operands (%d) for opManagedPerformDepose\", len(rawOperands))\n\t}\n\tcurrentObj, err := unmarshalGetPrevResultOf[*exec.ResourceInstanceObject](prevResults, rawOperands[0])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid opManagedPerformDepose currentObj: %w\", err)\n\t}\n\tfinalDeletePlan, err := unmarshalGetPrevResultOf[*exec.ManagedResourceObjectFinalPlan](prevResults, rawOperands[1])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid opManagedPerformDepose finalDeletePlan: %w\", err)\n\t}\n\twaitFor, err := unmarshalGetPrevResultWaiter(prevResults, rawOperands[2])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid opManagedPerformDepose waitFor: %w\", err)\n\t}\n\treturn builder.ManagedPerformDepose(currentObj, finalDeletePlan, waitFor), nil\n}\n\nfunc unmarshalOpManagedDeposedMeta(rawOperands []uint64, prevResults []AnyResultRef, builder *Builder) (AnyResultRef, error) {\n\tif len(rawOperands) != 3 {\n\t\treturn nil, fmt.Errorf(\"wrong number of operands (%d) for unmarshalOpManagedDeposedMeta\", len(rawOperands))\n\t}\n\tinstAddr, err := unmarshalGetPrevResultOf[addrs.AbsResourceInstance](prevResults, rawOperands[0])\n\tif err != nil {","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/opentofu/opentofu/blob/3561785c48c1ce615e7c50261bd351f26053efa2/internal/engine/internal/execgraph/graph_unmarshal.go#L236-L272","documentation":"While decoding an opManagedPerformDepose node, operand 0 (currentObj) did not reference a result of type *exec.ResourceInstanceObject — typically a Builder.ResourceInstancePrior result describing the object about to be deposed. The wrapped 'refers to X, but need Y' text comes from unmarshalGetPrevResultOf; nil slots coerce to NilResultRef without error, so this is a definite wrong-type reference in the serialized graph. Unmodified Marshal output cannot trigger it.","triggerScenarios":"UnmarshalGraph where opManagedPerformDepose's operands[0] points at an element of another type, e.g. an address constant or a final-plan result, due to operand-position shifts or corrupted bytes.","commonSituations":"Cross-version plan files exercising create-before-destroy; corrupted or re-serialized artifacts; forks rewiring the depose subgraph; hand-built ExecutionGraph bytes.","solutions":["Regenerate the plan with the same binary and re-apply","Re-create or checksum-verify the plan artifact","In programmatic graphs, pass the Builder.ResourceInstancePrior result for the instance being deposed as ManagedPerformDepose's first argument","Report an OpenTofu bug with the plan if the same version round-tripped it"],"exampleFix":"# before\ndeposeRef := builder.ManagedPerformDepose(addrRef, deletePlanRef, waiterRef) // currentObj slot holds an address ref\n\n# after\ncurrentObjRef := builder.ResourceInstancePrior(addrRef) // ResultRef[*exec.ResourceInstanceObject]\ndeposeRef := builder.ManagedPerformDepose(currentObjRef, deletePlanRef, waiterRef)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"graph, err := execgraph.UnmarshalGraph(plan.ExecutionGraph)\nif err != nil {\n    return nil, fmt.Errorf(\"invalid execution graph in plan (opManagedPerformDepose currentObj operand): %w\", err)\n}","preventionTips":["Source currentObj from Builder.ResourceInstancePrior or another object-typed result","Prefer compile-time-typed Builder calls over manual AnyResultRef wiring","Apply plans only from the binary that wrote them"],"tags":["go","opentofu","serialization","execution-graph","type-mismatch","operands","deposed","create-before-destroy","plan-file"],"backgroundTag":null,"analyzedSha":"3561785c48c1ce615e7c50261bd351f26053efa2","analyzedAt":"2026-08-15T23:27:16.226Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}