<p><a href="http://buildwithcraft.com/help/dev-mode" rel="nofollow">One of the things Dev Mode does</a> is put Twig into a strict mode where it will throw an error any time a variable is referenced that isn’t defined. So that explains why you’re only getting these errors when Dev Mode is enabled. The errors should also show the part of your template code where the error occurred.</p>

<p>If you are certain that this is a bug, please send in a ticket from your Dashboard, including your DB backup and template files, so we can look into it.</p>

CC BY-SA 3.0
2014-11-08T09:39:02.803Z
I think I found the problem. There was an entry tag in my index.html homepage file that wasn't being used (that page didn't have a section yet). So the problem probably originated there. 

BUT the error it threw pointed towards my _layout.html file and always at row 30. If I deleted some rows above it, it would still point towards row 30 while the error was at the index.html file.

Maybe that's a bug?

The craft.config.baseUrl error is another weird thing that sometimes comes back up, allthough I double checked and everything does work fine.
If I encounter it again, I'll send a bug report in!
Tom De Smet
CC BY-SA 3.0
2014-11-08T22:10:45.957Z
@TomDeSmet Sounds like a bug. Can you reproduce the issue again and then send in a support ticket from your dashboard?
Brandon Kelly
CC BY-SA 3.0
2014-11-11T12:15:06.193Z
Bug report sent!
Tom De Smet
CC BY-SA 3.0
2014-11-05T23:16:50.777Z
2014-11-05T23:16:50.777Z
Brandon Kelly
<p>This looks to be a Twig bug.</p>

<p>By the time the Twig exception makes it to Craft's <a href="http://buildwithcraft.com/classreference/etc/errors/ErrorHandler" rel="nofollow">ErrorHandler</a>, the wrong <code>_layout.html</code> file has already been set on the exception.</p>

<p>I'll try to come up with a barebones reproducible test case and create a Github issue with them.</p>

CC BY-SA 3.0
2014-11-11T19:44:21.440Z
2014-11-11T19:44:21.440Z
Brad Bell
<p>I use for example {{ craft.config.baseUrl }} where baseUrl is a custom variable in general.php</p>

<p>This works fine. But when I enable devMode it gives a template error 'craft variable unknown'.</p>

<p>I also get other template errors such as variable 'entry' unknown but I don't have a variable called entry in that template. These errors happen in my _layout template.</p>

<p>Weird thing is that with devMode false everything works fine.</p>

<p>I'm on mobile now but can post detailed code tomorrow if necessary.</p>

CC BY-SA 3.0
2014-11-06T00:44:50.593Z
When you say "everything works fine", have you checked the output within the HTML source? I'd venture to guess that the tags which throw errors in dev mode are simply outputting empty strings when dev mode is off.
Lindsey D
<devmode>
Dev mode giving multiple errors but everything works
# Dev mode giving multiple errors but everything works

(Asked by: username_0 on 2014-11-05)

I use for example {{ craft.config.baseUrl }} where baseUrl is a custom variable in general.php

This works fine. But when I enable devMode it gives a template error 'craft variable unknown'.

I also get other template errors such as variable 'entry' unknown but I don't have a variable called entry in that template. These errors happen in my \_layout template.

Weird thing is that with devMode false everything works fine.

I'm on mobile now but can post detailed code tomorrow if necessary.

**Tags:** devmode
> **Comments:**
> **username_1**: When you say "everything works fine", have you checked the output within the HTML source? I'd venture to guess that the tags which throw errors in dev mode are simply outputting empty strings when dev mode is off.  

---

## 2 answers

### Answer by username_2 on 2014-11-05. Score: 1

[One of the things Dev Mode does](http://buildwithcraft.com/help/dev-mode) is put Twig into a strict mode where it will throw an error any time a variable is referenced that isn’t defined. So that explains why you’re only getting these errors when Dev Mode is enabled. The errors should also show the part of your template code where the error occurred.

If you are certain that this is a bug, please send in a ticket from your Dashboard, including your DB backup and template files, so we can look into it.

> **Comments:**
> **username_0**: I think I found the problem. There was an entry tag in my index.html homepage file that wasn't being used (that page didn't have a section yet). So the problem probably originated there.   BUT the error it threw pointed towards my _layout.html file and always at row 30. If I deleted some rows above it, it would still point towards row 30 while the error was at the index.html file.  Maybe that's a bug?  The craft.config.baseUrl error is another weird thing that sometimes comes back up, allthough I double checked and everything does work fine. If I encounter it again, I'll send a bug report in!  
> **username_2**: @TomDeSmet Sounds like a bug. Can you reproduce the issue again and then send in a support ticket from your dashboard?  
> **username_0**: Bug report sent!  

---

### Answer by username_3 on 2014-11-11. Score: 0

This looks to be a Twig bug.

By the time the Twig exception makes it to Craft's [ErrorHandler](http://buildwithcraft.com/classreference/etc/errors/ErrorHandler), the wrong `_layout.html` file has already been set on the exception.

I'll try to come up with a barebones reproducible test case and create a Github issue with them.


---

