at one's wit's end
Also, at wits' end. Completely puzzled and perplexed, not knowing what to do. For example, I've tried every possible source without success, and now I'm at my wit's end. This idiom, which uses wit in the sense of "mental faculties," appeared in Piers Ploughman (c. 1377).
Dictionary.com presents 366 FAQs, incorporating some of the frequently asked questions from the past with newer queries.