If you look in the list of file paths in the stack trace there will be one or more files in the
storage/runtime/compiled_templates directory. In this particular case there is
storage/runtime/compiled_templates/1a/1a584296a...ccfb9.php under number 33 in the stack trace. (If you're using PhpStorm you can press shift twice and paste in the filename to find it quickly.)
This file contains a PHP class that Twig compiles when the template is first accessed, so that it doesn't need to parse through all the twig code converting it into PHP every time the template is accessed.
At the top of this file is a comment that contains the path of the actual twig template. If needed, you might be able to work out a bit more context by looking at code at the line number in the stack trace (it's the
:43 for this one). There will be another comment above this line that will tell you the line number in the twig template.
There may also be some clues in the stack trace itself. For example, here (again number 33 in the stack trace) you have the line:
This suggests to me that you're using the
|merge filter, on a
craft.categories query without calling
.all() on it first, which also makes sense given the deprecation notice.