<p>The problem is that you're using an <code>entry</code> variable in the layout template without it having actually been defined.</p>

<p>You can be defensive about it everywhere you're using it:</p>

<pre><code>{% if entry is defined and entry.canonicalUrl %}
</code></pre>

<p>Or you can be proactive with it and set the entry to something known ahead of time:</p>

<pre><code>{% set entry = craft.entries....first() %}
</code></pre>

<p>But it kind of depends on the behavior you're looking for on your site.</p>

CC BY-SA 3.0
2015-10-27T20:37:09.577Z
Thanks, Brad. When I define the entries, I'm taken to a 404 for any admin pages (but the actual site pages seem to work fine). Maybe this is some sort of hybrid issue between what you pointed out and what Lindsey D pointed out below?
dpayne
CC BY-SA 3.0
2015-10-27T20:52:32.077Z
Do the first thing I mentioned and guard against `entry` not being defined.
Brad Bell
CC BY-SA 3.0
2015-10-27T21:42:52.967Z
I did that and after doing so, I'm now getting the 404 page, rather than the error I was previously getting. Sorry that wasn't clear in my last message.
dpayne
CC BY-SA 3.0
2015-10-27T18:51:00.910Z
2015-10-27T18:51:00.910Z
Brad Bell
<p>The Twig runtime error was essentially answered by Brad. We used an entry variable without it having been defined for that particular element in our layout template and by adding <code>{% if entry is defined and entry.canonicalUrl %}</code>, it fixed the issue and the Twig error went away. The reason that the message appeared on local and not on the live site is because the local site was in developer mode. </p>

<p>As to the 404 page that appeared on admin pages after fixing the issue, that seems to be a separate issue and I'll create a separate thread. Here's the thread: <a href="https://craftcms.stackexchange.com/questions/12169/craft-cms-shows-404-error-on-admin-pages">Craft CMS Shows 404 Error on Admin Pages</a></p>

CC BY-SA 3.0
2015-10-29T15:41:21.817Z
2015-10-29T16:13:56.543Z
2017-04-13T12:51:00.200Z
dpayne
<p>This seems like one of two things:</p>

<ul>
<li>A bug in Craft</li>
<li>A corrupt installation</li>
</ul>

<p>Given that you're not doing anything terribly complex here, it's highly unlikely that you've uncovered an obscure bug in Craft. It's far more likely that certain files weren't downloaded properly.</p>

<p><strong>I'd recommend replacing your entire <code>craft/app</code> folder.</strong> The heart of Craft lies within that folder, simply replace it to ensure there are no corrupt file issues.</p>

<p>Also, you may want to completely delete the contents of your <code>craft/storage/runtime</code> folder... It's possible that you downloaded some temp files in there which are confusing your local installation.</p>

CC BY-SA 3.0
2015-10-27T18:39:40.810Z
Thanks, Lindsey! I deleted the contents of my /runtime folder and that wasn't the issue. I also deleted and then re downloaded the contents of the craft/app folder from our live prod site and that didn't fix the issue either. Note that I just downloaded the files and the database and updated my db folder to point to that new database, meaning that I didn't install Craft first and then add files retroactively. My understanding is that is the right way to do it and Craft would install on its own in that scenario, but I may have that wrong.
dpayne
CC BY-SA 3.0
2015-10-27T18:00:31.763Z
2015-10-27T18:00:31.763Z
Lindsey D
<p>Trying to set-up a Craft site on a local environment. The site is currently live and functions well on prod. On the local environment, the site seems to work fine, except that every time I try to access an admin page, I get the following error: </p>

<pre><code>Twig_Error_Runtime

Variable "entry" does not exist in "layouts/main/_layout" at line 29 (C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php:332)

#0 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\b3\54\0e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b.php(47): Twig_Template-&gt;getContext(Array, 'entry')
#1 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_b3540e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b-&gt;doDisplay(Array, Array)
#2 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
#3 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\95\c9\45c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe.php(26): Twig_Template-&gt;display(Array, Array)
#4 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_95c945c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe-&gt;doDisplay(Array, Array)
#5 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
#6 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(264): Twig_Template-&gt;display(Array)
#7 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Environment.php(292): Twig_Template-&gt;render(Array)
#8 C:\wamp\www\stage\craft\app\services\TemplatesService.php(220): Twig_Environment-&gt;render('404', Array)
#9 C:\wamp\www\stage\craft\app\controllers\BaseController.php(74): Craft\TemplatesService-&gt;render('404', Array)
#10 C:\wamp\www\stage\craft\app\controllers\TemplatesController.php(203): Craft\BaseController-&gt;renderTemplate('404', Array)
#11 C:\wamp\www\stage\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController-&gt;actionRenderError()
#12 C:\wamp\www\stage\craft\app\framework\web\CController.php(308): CInlineAction-&gt;runWithParams(Array)
#13 C:\wamp\www\stage\craft\app\framework\web\CController.php(286): CController-&gt;runAction(Object(CInlineAction))
#14 C:\wamp\www\stage\craft\app\framework\web\CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
#15 C:\wamp\www\stage\craft\app\framework\web\CWebApplication.php(282): CController-&gt;run('renderError')
#16 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(331): CWebApplication-&gt;runController('templates/rende...')
#17 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(204): CErrorHandler-&gt;render('error', Array)
#18 C:\wamp\www\stage\craft\app\etc\errors\ErrorHandler.php(128): CErrorHandler-&gt;handleException(Object(Craft\HttpException))
#19 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(129): Craft\ErrorHandler-&gt;handleException(Object(Craft\HttpException))
#20 C:\wamp\www\stage\craft\app\framework\base\CApplication.php(732): CErrorHandler-&gt;handle(Object(CExceptionEvent))
#21 [internal function]: CApplication-&gt;handleException(Object(Craft\HttpException))
#22 {main}
</code></pre>

<p>And here is the layouts/main/_layouts code:</p>

<pre><code>{#
 # Layout template
 # ---------------
 #
 # This template defines your site�s global layout. It can be
 # �extended� by other templates to fill in the gaps.
 #
 # See Twig�s Template Inheritance documentation for more details:
 # http://twig.sensiolabs.org/doc/templates.html#template-inheritance
 #}

&lt;!DOCTYPE html&gt;
&lt;html lang="en-US"&gt;
&lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;!--[if IE]&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;
  &lt;![endif]--&gt;

  &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  &lt;meta property="og:locale" content="en_US" /&gt;
  &lt;meta property="og:type" content="website" /&gt;

  {% block meta %}{% endblock %}

  &lt;head profile="http://www.w3.org/2005/10/profile"&gt;
  &lt;link rel="icon" type="image/png" href="{{ seo.favicon[0].getUrl() }}"&gt;

  {% if entry.canonicalUrl %}
    &lt;link rel="canonical" href="{{ entry.canonicalUrl }}" /&gt;
  {% endif %}

  &lt;title&gt;{% if entry.pageTitle %}{{ entry.pageTitle | raw }}{% else %}{{ entry.title | raw }}{% endif %}&lt;/title&gt;
  &lt;meta name="description" content="{% if entry.seoDescription is defined %}{{ entry.seoDescription }}{% else %}{{ seo.seoDescription }}{% endif %}" /&gt;
  &lt;meta name="keywords" content="{% if entry.seoKeywords is defined %}{{ entry.seoKeywords }}{% else %}{{ seo.seoKeywords }}{% endif %}" /&gt;

  &lt;link rel="home" href="{{ siteUrl }}" /&gt;


    &lt;link rel="stylesheet" href="{{ craft.bust.er('/lib/css/dev/base.css') }}"&gt;





    &lt;link href="{{ craft.bust.er('/lib/css/parallax.css') }}" type="text/css" rel="stylesheet" data-skrollr-stylesheet /&gt;




  &lt;!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --&gt;
  &lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&gt;
  &lt;!--[if lt IE 9]&gt;
    &lt;script src="{{ craft.bust.er('/lib/js/ie8.min.js') }}"&gt;&lt;/script&gt;
  &lt;![endif]--&gt;

  &lt;!-- SHARING --&gt;
  {% if entry is defined %}

    {% if entry.sharingText %}
      {% set description = entry.sharingText %}
    {% elseif entry.seoDescription %}
      {% set description = entry.seoDescription %}
    {% else %}
      {% if entry.section == 'blogPosts' %}
        {% set description = entry.entryContent | trimit(600) %}
      {% elseif socialMedia.sharingText %}
        {% set description = socialMedia.sharingText %}
      {% elseif seo.seoDescription %}
        {% set description = seo.seoDescription %}
      {% else %}
        {% set description = '' %}
      {% endif %}
    {% endif %}

    {%if entry.pageTitle %}
      {% set title = entry.pageTitle %}
    {% else %}
      {% set title = entry.title %}
    {% endif %}

    &lt;meta property="og:title" content="{{ title }}" /&gt;
    &lt;meta property="og:description" content="{{ description }}" /&gt;
    {# SHARING IMAGE // defaults to global.  Otherwise set the block in your template #}
    {% include "layouts/main/partials/_sharingImage" %}
  {% endif %}
    &lt;meta property="og:url" content="{{ entry.Url }}" /&gt;

&lt;!-- Start Visual Website Optimizer Asynchronous Code --&gt;
&lt;script type='text/javascript'&gt;
var _vwo_code=(function(){
var account_id=126816,
settings_tolerance=2000,
library_tolerance=2500,
use_existing_jquery=false,
// DO NOT EDIT BELOW THIS LINE
f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&amp;u='+encodeURIComponent(d.URL)+'&amp;r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
&lt;/script&gt;
&lt;!-- End Visual Website Optimizer Asynchronous Code --&gt;

&lt;/head&gt;

&lt;body class="craft page-{{ craft.request.lastSegment() }} section-{{ craft.request.firstSegment() }}"&gt;

&lt;!-- Google Tag Manager --&gt;
&lt;noscript&gt;&lt;iframe src="//www.googletagmanager.com/ns.html?id=GTM-5N2WB8"
height="0" width="0" style="display:none;visibility:hidden"&gt;&lt;/iframe&gt;&lt;/noscript&gt;
&lt;script&gt;(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5N2WB8');&lt;/script&gt;
&lt;!-- End Google Tag Manager --&gt;

&lt;div&gt;

  {# COOKIE NOTIFICATION FOR EU USERS - Hidden by default.  Ajax call to /api/showCookieNotification.html may cause this to appear if user is visiting site for first time in EU (uses session cookie) #}
  &lt;div id="cookieNotice" class="alert alert-success alert-dismissible"&gt;
    &lt;button type="button" class="close" data-dismiss="alert"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;&lt;/button&gt;
    &lt;div class="container"&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-md-12"&gt;
          {{ default.cookieNotice }}
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  {% include "layouts/main/partials/_mainNav.html" %}

  &lt;div id="skrollr-body"&gt;

      {% set _layout = block('layout') %}
      {% if _layout is not empty %}
          {{ _layout|raw }}
       {% else %}

          {% block content %}
            &lt;p&gt;If you see me, you haven�t set your &lt;code&gt;{% verbatim %}{% block content %}�{% endblock %}{% endverbatim %}&lt;/code&gt; yet.&lt;/p&gt;
            &lt;p&gt;See Twig�s &lt;a href="http://twig.sensiolabs.org/doc/templates.html#template-inheritance"&gt;Template Inheritance&lt;/a&gt; documentation for an explanation.&lt;/p&gt;
          {% endblock %}


      {% endif %}

      {% include "layouts/main/partials/_mobileNav.html" %}

      {% include "layouts/main/partials/_footerNav.html" %}

  &lt;/div&gt;&lt;!-- END #skrollr-body --&gt;


    &lt;script type="text/javascript" src="{{ craft.bust.er('/lib/js/dev/vendor.js') }}"&gt;&lt;/script&gt;




  &lt;script type="text/javascript" defer="defer" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53a9b2ec75518a77"&gt;&lt;/script&gt;


  &lt;!-- TYPEKIT --&gt;
  &lt;script src="//use.typekit.net/nfj8gcg.js"&gt;&lt;/script&gt;
  &lt;script&gt;try{Typekit.load();}catch(e){}&lt;/script&gt;

  {{ getFootHtml() }}


    &lt;script type="text/javascript" src="{{ craft.bust.er('/lib/js/dev/main.js') }}"&gt;&lt;/script&gt;







&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Any idea what's going on here and possible fixes?</p>

<p>Thanks!</p>

CC BY-SA 3.0
2015-10-27T18:06:23.570Z
If I had to guess, you've got devMode disabled on production and that template error is being hidden, but enabled locally where you can see it.  But it looks like a simple template logic error. Can you edit your original question and share the contents of your `layouts/main/_layout` file?
Brad Bell
CC BY-SA 3.0
2015-10-27T18:33:31.397Z
Sure thing - layouts file has been added to the question above. Thanks!
dpayne
<installation>
Twig Error Runtime Local Dev Environment
# Twig Error Runtime Local Dev Environment

(Asked by: username_0 on 2015-10-27)

Trying to set-up a Craft site on a local environment. The site is currently live and functions well on prod. On the local environment, the site seems to work fine, except that every time I try to access an admin page, I get the following error: 
Twig_Error_Runtime

Variable "entry" does not exist in "layouts/main/_layout" at line 29 (C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php:332)

#0 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\b3\54\0e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b.php(47): Twig_Template->getContext(Array, 'entry')
#1 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_b3540e5036bda0f90c30db509f858e96127617afb2773e83d81aa61dc5b4e29b->doDisplay(Array, Array)
#2 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array)
#3 C:\wamp\www\stage\craft\storage\runtime\compiled_templates\95\c9\45c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe.php(26): Twig_Template->display(Array, Array)
#4 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_95c945c04614017a210d5882c1a2a1f87467f3a26a51d13ab2f7ee1ff3b62ffe->doDisplay(Array, Array)
#5 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array)
#6 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Template.php(264): Twig_Template->display(Array)
#7 C:\wamp\www\stage\craft\app\vendor\twig\twig\lib\Twig\Environment.php(292): Twig_Template->render(Array)
#8 C:\wamp\www\stage\craft\app\services\TemplatesService.php(220): Twig_Environment->render('404', Array)
#9 C:\wamp\www\stage\craft\app\controllers\BaseController.php(74): Craft\TemplatesService->render('404', Array)
#10 C:\wamp\www\stage\craft\app\controllers\TemplatesController.php(203): Craft\BaseController->renderTemplate('404', Array)
#11 C:\wamp\www\stage\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController->actionRenderError()
#12 C:\wamp\www\stage\craft\app\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#13 C:\wamp\www\stage\craft\app\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#14 C:\wamp\www\stage\craft\app\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#15 C:\wamp\www\stage\craft\app\framework\web\CWebApplication.php(282): CController->run('renderError')
#16 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(331): CWebApplication->runController('templates/rende...')
#17 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(204): CErrorHandler->render('error', Array)
#18 C:\wamp\www\stage\craft\app\etc\errors\ErrorHandler.php(128): CErrorHandler->handleException(Object(Craft\HttpException))
#19 C:\wamp\www\stage\craft\app\framework\base\CErrorHandler.php(129): Craft\ErrorHandler->handleException(Object(Craft\HttpException))
#20 C:\wamp\www\stage\craft\app\framework\base\CApplication.php(732): CErrorHandler->handle(Object(CExceptionEvent))
#21 [internal function]: CApplication->handleException(Object(Craft\HttpException))
#22 {main}

And here is the layouts/main/_layouts code:
{#
 # Layout template
 # ---------------
 #
 # This template defines your site�s global layout. It can be
 # �extended� by other templates to fill in the gaps.
 #
 # See Twig�s Template Inheritance documentation for more details:
 # http://twig.sensiolabs.org/doc/templates.html#template-inheritance
 #}




  
  

  
  
  

  {% block meta %}{% endblock %}

  
  

  {% if entry.canonicalUrl %}
    
  {% endif %}

  {% if entry.pageTitle %}{{ entry.pageTitle | raw }}{% else %}{{ entry.title | raw }}{% endif %}
  
  

  


    





    




  
  
  

  
  {% if entry is defined %}

    {% if entry.sharingText %}
      {% set description = entry.sharingText %}
    {% elseif entry.seoDescription %}
      {% set description = entry.seoDescription %}
    {% else %}
      {% if entry.section == 'blogPosts' %}
        {% set description = entry.entryContent | trimit(600) %}
      {% elseif socialMedia.sharingText %}
        {% set description = socialMedia.sharingText %}
      {% elseif seo.seoDescription %}
        {% set description = seo.seoDescription %}
      {% else %}
        {% set description = '' %}
      {% endif %}
    {% endif %}

    {%if entry.pageTitle %}
      {% set title = entry.pageTitle %}
    {% else %}
      {% set title = entry.title %}
    {% endif %}

    
    
    {# SHARING IMAGE // defaults to global.  Otherwise set the block in your template #}
    {% include "layouts/main/partials/_sharingImage" %}
  {% endif %}
    
















  {# COOKIE NOTIFICATION FOR EU USERS - Hidden by default.  Ajax call to /api/showCookieNotification.html may cause this to appear if user is visiting site for first time in EU (uses session cookie) #}
  
    ×Close
    
      
        
          {{ default.cookieNotice }}
        
      
    
  

  {% include "layouts/main/partials/_mainNav.html" %}

  

      {% set _layout = block('layout') %}
      {% if _layout is not empty %}
          {{ _layout|raw }}
       {% else %}

          {% block content %}
            If you see me, you haven�t set your {% verbatim %}{% block content %}�{% endblock %}{% endverbatim %} yet.
            See Twig�s Template Inheritance documentation for an explanation.
          {% endblock %}


      {% endif %}

      {% include "layouts/main/partials/_mobileNav.html" %}

      {% include "layouts/main/partials/_footerNav.html" %}

  


    




  


  
  
  

  {{ getFootHtml() }}


    












Any idea what's going on here and possible fixes?
Thanks!

**Tags:** installation

> **Comments:**
> **username_1**: If I had to guess, you've got devMode disabled on production and that template error is being hidden, but enabled locally where you can see it.  But it looks like a simple template logic error. Can you edit your original question and share the contents of your `layouts/main/_layout` file?  
> **username_0**: Sure thing - layouts file has been added to the question above. Thanks!  

---

## 3 answers

### Answer by username_0 on 2015-10-29. Score: 0 | Accepted answer

The Twig runtime error was essentially answered by Brad. We used an entry variable without it having been defined for that particular element in our layout template and by adding `{% if entry is defined and entry.canonicalUrl %}`, it fixed the issue and the Twig error went away. The reason that the message appeared on local and not on the live site is because the local site was in developer mode.

As to the 404 page that appeared on admin pages after fixing the issue, that seems to be a separate issue and I'll create a separate thread. Here's the thread: [Craft CMS Shows 404 Error on Admin Pages](https://craftcms.stackexchange.com/questions/12169/craft-cms-shows-404-error-on-admin-pages)


---

### Answer by username_1 on 2015-10-27. Score: 3

The problem is that you're using an entry variable in the layout template without it having actually been defined.
You can be defensive about it everywhere you're using it:
{% if entry is defined and entry.canonicalUrl %}

Or you can be proactive with it and set the entry to something known ahead of time:
{% set entry = craft.entries....first() %}

But it kind of depends on the behavior you're looking for on your site.

> **Comments:**
> **username_0**: Thanks, Brad. When I define the entries, I'm taken to a 404 for any admin pages (but the actual site pages seem to work fine). Maybe this is some sort of hybrid issue between what you pointed out and what username_2 pointed out below?  
> **username_1**: Do the first thing I mentioned and guard against `entry` not being defined.  
> **username_0**: I did that and after doing so, I'm now getting the 404 page, rather than the error I was previously getting. Sorry that wasn't clear in my last message.  

---

### Answer by username_2 on 2015-10-27. Score: 1

This seems like one of two things:

* A bug in Craft
* A corrupt installation

Given that you're not doing anything terribly complex here, it's highly unlikely that you've uncovered an obscure bug in Craft. It's far more likely that certain files weren't downloaded properly.

**I'd recommend replacing your entire `craft/app` folder.** The heart of Craft lies within that folder, simply replace it to ensure there are no corrupt file issues.

Also, you may want to completely delete the contents of your `craft/storage/runtime` folder... It's possible that you downloaded some temp files in there which are confusing your local installation.

> **Comments:**
> **username_0**: Thanks, Lindsey! I deleted the contents of my /runtime folder and that wasn't the issue. I also deleted and then re downloaded the contents of the craft/app folder from our live prod site and that didn't fix the issue either. Note that I just downloaded the files and the database and updated my db folder to point to that new database, meaning that I didn't install Craft first and then add files retroactively. My understanding is that is the right way to do it and Craft would install on its own in that scenario, but I may have that wrong.  

---

