<p>You're outputting an unexecuted <a href="https://craftcms.com/docs/4.x/element-queries.html" rel="nofollow noreferrer">Element Query</a>. To clarify - the thing stored in your Entries field named <code>buttonLink</code> is not a Craft entry as you might expect, but is basically a raw unexecuted database query (that will fetch the selected entry once executed). In Craft 3 those unexecuted queries automatically got executed if you attempt to output them, but they should throw deprecation errors in the control panel (Utilities &gt; Deprecation Errors). In Craft 4 you can't get away with that anymore.</p>
<p>The quick and easy solution is to execute the query. There are a few ways to execute queries: <a href="https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries</a></p>
<p>But really, the &quot;proper&quot; solution here is to add some <a href="https://craftcms.com/docs/4.x/dev/eager-loading-elements.html" rel="nofollow noreferrer">eager loading</a> so that all your child queries are combined into the queries used to fetch the parent matrix block(s). This is significantly more performant, especially if you're outputting multiple matrix blocks (though I see from your code you're only outputting one).</p>
<p>Here's how eager loading might look for your code:</p>
<pre><code>{% set button = cta.button.with('buttonLink').one() %}
&lt;a href=&quot;{{ button.buttonLink[0].url }}&quot;&gt;&lt;div class=&quot;button&quot;&gt;{{ button.buttonText }}&lt;/div&gt;&lt;/a&gt;
</code></pre>
<p>Or without eager loading (don't do this):</p>
<pre><code>{% set button = cta.button.one() %}
&lt;a href=&quot;{{ button.buttonLink.one().url }}&quot;&gt;&lt;div class=&quot;button&quot;&gt;{{ button.buttonText }}&lt;/div&gt;&lt;/a&gt;
</code></pre>

CC BY-SA 4.0
2022-06-15T06:37:32.217Z
Thank your very much for your answer!
aren
CC BY-SA 4.0
2022-06-14T15:17:14.900Z
2022-06-14T15:17:14.900Z
James Smith
<p>Some of my links coming from a matrix field with entry became corrupted. Anyone had this before and knows how to fix it?
<a href="https://i.sstatic.net/QMBou.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QMBou.png" alt="admin field" /></a>
<a href="https://i.sstatic.net/5nLIS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5nLIS.png" alt="entry" /></a>
<a href="https://i.sstatic.net/0hO3Z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0hO3Z.png" alt="corrupted link" /></a>
<a href="https://i.sstatic.net/gbjpt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gbjpt.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-06-14T10:17:57.673Z
It looks like you're trying to output an unexecuted Element Query. Please can you add your template code responsible for this output and we'll help explain how best to fix.
James Smith
CC BY-SA 4.0
2022-06-14T11:27:21.263Z
I added it. Thanks for your response!
aren
<matrix><field><error><link>
Matrix field entry link corrupted
# Matrix field entry link corrupted

(Asked by: username_0 on 2022-06-14)

Some of my links coming from a matrix field with entry became corrupted. Anyone had this before and knows how to fix it?
[![admin field](https://i.sstatic.net/QMBou.png)](https://i.sstatic.net/QMBou.png)
[![entry](https://i.sstatic.net/5nLIS.png)](https://i.sstatic.net/5nLIS.png)
[![corrupted link](https://i.sstatic.net/0hO3Z.png)](https://i.sstatic.net/0hO3Z.png)
[![enter image description here](https://i.sstatic.net/gbjpt.png)](https://i.sstatic.net/gbjpt.png)

**Tags:** matrix, field, error, link
> **Comments:**
> **username_1**: It looks like you're trying to output an unexecuted Element Query. Please can you add your template code responsible for this output and we'll help explain how best to fix.  
> **username_0**: I added it. Thanks for your response!  

---

## 1 answers

### Answer by username_1 on 2022-06-14. Score: 1 | Accepted answer

You're outputting an unexecuted Element Query. To clarify - the thing stored in your Entries field named buttonLink is not a Craft entry as you might expect, but is basically a raw unexecuted database query (that will fetch the selected entry once executed). In Craft 3 those unexecuted queries automatically got executed if you attempt to output them, but they should throw deprecation errors in the control panel (Utilities > Deprecation Errors). In Craft 4 you can't get away with that anymore.
The quick and easy solution is to execute the query. There are a few ways to execute queries: https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries
But really, the "proper" solution here is to add some eager loading so that all your child queries are combined into the queries used to fetch the parent matrix block(s). This is significantly more performant, especially if you're outputting multiple matrix blocks (though I see from your code you're only outputting one).
Here's how eager loading might look for your code:
{% set button = cta.button.with('buttonLink').one() %}
{{ button.buttonText }}

Or without eager loading (don't do this):
{% set button = cta.button.one() %}
{{ button.buttonText }}

> **Comments:**
> **username_0**: Thank your very much for your answer!  

---

