Improve exception message for unexpected duplicate children

(cherry picked from commit 6963da6110743e5cf8bc357d3bfd37e683a70141)