<p>In short, those two have nothing to do with each other. What's more likely is that the error is being triggered <strong>by the imported script</strong>. It's possible that your stack trace is just giving you a red herring by pointing to the import itself.</p>

<hr>

<p><strong>In your Twig code:</strong></p>

<p><a href="http://twig.sensiolabs.org/doc/tags/import.html" rel="nofollow noreferrer"><code>import</code></a> pulls in a macro (or macros).</p>

<p><code>_self</code> just means "this template file".</p>

<p>"mcr_home" is just how you're referring to your imported macro(s).</p>

<p><strong>In the error message:</strong></p>

<p>An <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel" rel="nofollow noreferrer"><code>ElementCriteriaModel</code></a> is simply <a href="https://craftcms.stackexchange.com/q/2763/45">a model representing a Craft content search</a>.</p>

<p>"could not be converted to string" is telling you that the model cannot be read as a string.</p>

<hr>

<p>Obviously there is no correlation there. Take a closer look at the macro(s) you are importing... I'm certain you will find an ElementCriteriaModel which is attempting to be used as a string.</p>

CC BY-SA 3.0
2015-05-26T15:30:47.763Z
There was a lot of code in the template so the error pointing to that line really threw me off. Turns out it was something in the template that it was extending. {% extends "_layout" %}

Seems strange that the error was so utterly useless.
Jake Cattrall
CC BY-SA 3.0
2015-05-23T20:48:17.283Z
2015-05-23T20:48:17.283Z
2017-04-13T12:50:59.930Z
Lindsey D
<p><code>{% import _self as mcr_home %}</code></p>

<p>is throwing</p>

<blockquote>
  <p>Object of class Craft\ElementCriteriaModel could not be converted to string</p>
</blockquote>

<p>How is this possible and how do I fix it?</p>

CC BY-SA 3.0
2015-05-22T17:39:40.167Z
Any name collisions? With "import", or "_self" or "mcr_home"?
Marion Newlevant
CC BY-SA 3.0
2015-05-22T19:32:36.953Z
Can you enable devMode, reproduce the error then share the full stack trace so we can see where the error originates from?
Brad Bell
<templating><import>
import _self throwing ElementCriteriaModel could not be converted to string
# import _self throwing ElementCriteriaModel could not be converted to string

(Asked by: username_0 on 2015-05-22)

`{% import _self as mcr_home %}`

is throwing

> Object of class Craft\ElementCriteriaModel could not be converted to string

How is this possible and how do I fix it?

**Tags:** templating, import
> **Comments:**
> **username_1**: Any name collisions? With "import", or "_self" or "mcr_home"?  
> **username_2**: Can you enable devMode, reproduce the error then share the full stack trace so we can see where the error originates from?  

---

## 1 answers

### Answer by username_3 on 2015-05-23. Score: 3 | Accepted answer

In short, those two have nothing to do with each other. What's more likely is that the error is being triggered **by the imported script**. It's possible that your stack trace is just giving you a red herring by pointing to the import itself.

---

**In your Twig code:**

[`import`](http://twig.sensiolabs.org/doc/tags/import.html) pulls in a macro (or macros).

`_self` just means "this template file".

"mcr\_home" is just how you're referring to your imported macro(s).

**In the error message:**

An [`ElementCriteriaModel`](http://buildwithcraft.com/docs/templating/elementcriteriamodel) is simply [a model representing a Craft content search](https://craftcms.stackexchange.com/q/2763/45).

"could not be converted to string" is telling you that the model cannot be read as a string.

---

Obviously there is no correlation there. Take a closer look at the macro(s) you are importing... I'm certain you will find an ElementCriteriaModel which is attempting to be used as a string.

> **Comments:**
> **username_0**: There was a lot of code in the template so the error pointing to that line really threw me off. Turns out it was something in the template that it was extending. {% extends "_layout" %}  Seems strange that the error was so utterly useless.  

---

