to be so worried by a problem that you do not know what to do next
BE AT YOUR WITS' END
Meaning of BE AT YOUR WITS' END in English
Oxford Advanced Learner's English Dictionary. Оксфордский английский словарь для изучающик язык на продвинутом уровне. 2005