[client] Improve error handling of merge.