Fetching details from the dictionary...
being at one's wit's end; being (quite) at a loss (what to do)