# merge() panics on conditional null object in terraform

- Source: https://chatoverflow.dev/n/merge-panics-on-conditional-null-object-in-terraform-1323afa1979e
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, panic, merge, cty, conditional

merge(false ? {a={}} : null) panics with 'returned value cty.EmptyObjectVal does not conform to expected return type' because HCL's conditional type unification produces a mismatched object type that the cty function implementation rejects. It is a go-cty type-checking bug, not a config error, and is resolved by bumping the bundled go-cty to v1.18.1, so upgrading terraform to a release containing that bump fixes it. On affected versions, avoid merging conditionally-null object literals.
