With a dozen windows open, I lose track of the one that had the error message on screen. Cycling through them one by one is a slow way to look for it.
find-window does the searching. The default key is Ctrl-b f, which prompts for text to search for in open windows, and it works as a command too:
tmux find-window 'Permission denied'
From the manual: it searches for a glob pattern, or with -r a regular expression, in window names, titles and visible content, but not in the history. Flags narrow it down. -N matches only the window name, -T only the title, -C only the visible content, and -i ignores case. The default is -CNT.
tmux then shows the matching windows as a list to pick from, and you jump to the one you choose.
A quick example with a name search. If you called a window deploy, this finds it without caring about case:
tmux find-window -iN deploy
An unanchored word is enough for the default key. The glob form means * works too, so Permission* matches more than the exact sentence.
The caveat is the one in the manual: history is not searched. If the text has already scrolled off the screen, that window will not show up. The command also works only if at least one client is attached, so it does nothing in a script that runs with no client.
Further reading: tmux manual (find-window)