"Sorry, something went wrong" when trying to "Set up nearby device" I have a new Google Nexus 5X model LH-H790, that's meant to replace an also new Nexus 5X LG-H791.

When I try to transfer the account from phone to phone ("Set up nearby device") I see the confirmation code as expected on both phones.  Pressing next gives the unhelpful error message "Sorry, something went wrong".

The devices are next to each other, or nearby, or touching, both connected to the same WiFi, and both machines are virtually new.  What could cause "Sorry, something went wrong"?
I had the same issue today. I had to replace my old (broken) Nexus 5X to a new Nexus 5X.

After unsucessfull tries (same error message as you) I started to all reconfigure manually when I noticed my old Nexus 5X was running Android 7.0 and the new stock Nexus 5X was still on Android 6.0. 

So here is what I did: I accepted the update to Android 7.0, then did a factory reset on the new phone and I restarted the procedure and it worked like a charm.