Merge "Properly preserve trace on error during wait"