Answers.Body: <p>I figured out the issue.  I was trying to get a single image from a matrix block by <code>block.image|first</code> instead of <code>block.image.one()</code>. The code was in a macro that was used on several templates so those templates got this error.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-07T19:50:44.937Z
Answers.LastActivityDate: 2018-07-07T19:50:44.937Z
Answers.UserDisplayName: Ryan
Body: <p>I'm getting a deprecation error from not using <code>.all()</code> to query my elements:</p>
  
  <pre><code>Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.
  </code></pre>
  
  <p>This is usually very easy to fix because Craft normally tells you which template and line to add the <code>.all()</code> to.  However, when looking at the origin, I see:</p>
  
  <pre><code>/Users/Me/Sites/Project/vendor/twig/twig/lib/Twig/Extension/Core.php:577
  </code></pre>
  
  <p>This is pointing to something in Twig's vendor library, which I obviously don't want to fix for updating reasons.  Does anyone know what this is referring to in my templates?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-07T15:05:32.297Z
Comments.Text: This is really difficult to spot. You could take a look at the stack trace to spot at least the URL route so get to know the root template
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-07T16:57:52.023Z
Comments.Text: I know the root template because I'm on the page and see the error in the debug toolbar.  It happens on a couple of pages of mine, but I don't understand what it wants me to change in the template code. All my element queries have the `.all()` added.  The error doesn't appear on all pages though, and I can't figure out what's different between the templates to cause the error in some instances but not others.
Comments.UserDisplayName: Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-07T17:01:27.497Z
Comments.Text: I guess some of your `ElementQueries` are not executed otherwise the error would not appear. You can edit the source code and instead of creating a deprecated error you dump the Query so you can see what things are searched. Or you post your Twig so we can search for it. Besides that I don't know how we are supposed to help. It's like fishing without water
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-07T17:09:34.060Z
Comments.Text: If it's any help: it is executed in a `twig_array_merge` function so likely  you are trying to `|merge` a `Query`
Comments.UserDisplayName: Robin Schambach
Tags: <templating><craft3><error-message>
Title: Craft 3 Deprecation Error from Twig/Extension/Core.php. How to fix?
ThreadText: # Craft 3 Deprecation Error from Twig/Extension/Core.php. How to fix?
  
  (Asked by: username_0 on 2018-07-07)
  
  I'm getting a deprecation error from not using `.all()` to query my elements:
  
  ```
  Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.
  
  ```
  
  This is usually very easy to fix because Craft normally tells you which template and line to add the `.all()` to. However, when looking at the origin, I see:
  
  ```
  /Users/Me/Sites/Project/vendor/twig/twig/lib/Twig/Extension/Core.php:577
  
  ```
  
  This is pointing to something in Twig's vendor library, which I obviously don't want to fix for updating reasons. Does anyone know what this is referring to in my templates?
  
  **Tags:** templating, craft3, error-message
  
  > **Comments:**
  > **username_1**: This is really difficult to spot. You could take a look at the stack trace to spot at least the URL route so get to know the root template  
  > **username_0**: I know the root template because I'm on the page and see the error in the debug toolbar.  It happens on a couple of pages of mine, but I don't understand what it wants me to change in the template code. All my element queries have the `.all()` added.  The error doesn't appear on all pages though, and I can't figure out what's different between the templates to cause the error in some instances but not others.  
  > **username_1**: I guess some of your `ElementQueries` are not executed otherwise the error would not appear. You can edit the source code and instead of creating a deprecated error you dump the Query so you can see what things are searched. Or you post your Twig so we can search for it. Besides that I don't know how we are supposed to help. It's like fishing without water  
  > **username_1**: If it's any help: it is executed in a `twig_array_merge` function so likely  you are trying to `|merge` a `Query`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-07-07. Score: 2 | Accepted answer
  
  I figured out the issue. I was trying to get a single image from a matrix block by `block.image|first` instead of `block.image.one()`. The code was in a macro that was used on several templates so those templates got this error.
  
  
  ---
  
  