Answers.Body: <p>Thanks everyone for taking a look. I forgot that I had implemented something on the receiving templates that allowed you to navigate between articles from the newsletter, if the referral url was the newsletter. After I implemented the text only block, I forgot to change this to ignore those blocks.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-17T01:08:16.477Z
Answers.LastActivityDate: 2018-05-17T01:08:16.477Z
Answers.UserDisplayName: Jono
Body: <p>Receiving the standard error:</p>
  
  <blockquote>
    <p>Craft\MatrixBlockModel and its behaviors do not have a method or
    closure named "sectionArticles".</p>
  </blockquote>
  
  <p>The problem is that this error doesn't make sense. Here is why:</p>
  
  <ol>
  <li>I have a newsletter template with the block 'sectionArticles'</li>
  <li>It lists entries from 3 different sections</li>
  <li>These 3 sections do not have a block 'sectionArticles' nor a reference to it in their templates.</li>
  <li>If I click on a link that leads to the url for these entries, I receive the above error</li>
  <li>If I copy and paste the url into a new tab everything is fine</li>
  <li>This only recently started happening. In other words, old issues of the newsletter are fine</li>
  </ol>
  
  <p>Help?</p>
  
  <p>Here is code for referring template:</p>
  
  <pre><code>{% for block in entry.connectionsContent %}
    {% switch block.type %}
      {% case "connectionsTextOnly" %}
        &lt;div class="{{ block.backgroundColor }} page-section"&gt;
          &lt;div class="row"&gt;
            {% set asset = block.sectionImage.first() %}
            {% if asset %}
              &lt;div class="large-3 medium-4 small-12 columns large-push-9 medium-push-8"&gt;
                &lt;img src="{{ asset.url }}"&gt;
              &lt;/div&gt;
              &lt;div class="large-9 medium-8 small-12 columns large-pull-3 medium-pull-4"&gt;
            {% else %}
              &lt;div class="small-12 columns"&gt;
            {% endif %}
                {{ block.sectionText }}
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      {% default %}
        {% set entries = block.sectionArticles %}
        {% if entries | length %}
          &lt;div class="{{ block.backgroundColor }} page-section article-grid"&gt;
            &lt;div class="row large-up-4 medium-up-2" data-equalizer data-equalize-on="medium"&gt;
              {% for entry in entries %}
                {% if entry.section.handle == "news" %}
                  {% include 'news/_includes/feed' %}
                {% elseif entry.section.handle == "pages" %}
                  {% include 'pages/_includes/feed' %}
                {% elseif entry.section.handle == "events" %}
                  {% include 'events/_includes/feed' %}
                {% endif %}
              {% endfor %}
            &lt;/div&gt;
          &lt;/div&gt;
        {% endif %}
      {% endswitch %}
  {% endfor %}
  </code></pre>
  
  <p>The feed templates are just links and display fine.</p>
  
  <p>The errors occurs on the events/_entry, news/_entry and pages/_entry templates. There is no references of the block 'sectionArticles' in those templates.</p>
  
  <p>One more thing: the error only happens on scheduled entries, where the Post Date is in the future, after the Post Date has arrived.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-14T15:03:19.470Z
Comments.Text: can you please share the template code that seems to be throwing this error?
Comments.UserDisplayName: Jalen Davenport
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-14T23:20:25.193Z
Comments.Text: How is `block` getting defined in your template?  Are you looping through all of your Matrix blocks?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-15T20:59:39.920Z
Comments.Text: I updated above to include the block and switch. After further research, it turns out that the error is thrown only when a "connectionsTextOnly" block exists.
  
  Still doesn't answer the question of why it throws the error after you leave
Comments.UserDisplayName: Jono
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-16T00:01:06.580Z
Comments.Text: By using `{% default %}`, you're saying that every block not named `connectionsTextOnly` is going to have a `sectionArticles` field in it... is that the case?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-17T00:47:44.383Z
Comments.Text: correct. There are only two block types.
Comments.UserDisplayName: Jono
Tags: <templating><matrix><error-message><error><error-handling>
Title: Internal Server Error: missing method or closure
ThreadText: # Internal Server Error: missing method or closure
  
  (Asked by: username_0 on 2018-05-14)
  
  Receiving the standard error:
  
  > Craft\MatrixBlockModel and its behaviors do not have a method or
  > closure named "sectionArticles".
  
  The problem is that this error doesn't make sense. Here is why:
  
  1. I have a newsletter template with the block 'sectionArticles'
  2. It lists entries from 3 different sections
  3. These 3 sections do not have a block 'sectionArticles' nor a reference to it in their templates.
  4. If I click on a link that leads to the url for these entries, I receive the above error
  5. If I copy and paste the url into a new tab everything is fine
  6. This only recently started happening. In other words, old issues of the newsletter are fine
  
  Help?
  
  Here is code for referring template:
  
  ```
  {% for block in entry.connectionsContent %}
    {% switch block.type %}
      {% case "connectionsTextOnly" %}
        <div class="{{ block.backgroundColor }} page-section">
          <div class="row">
            {% set asset = block.sectionImage.first() %}
            {% if asset %}
              <div class="large-3 medium-4 small-12 columns large-push-9 medium-push-8">
                <img src="{{ asset.url }}">
              </div>
              <div class="large-9 medium-8 small-12 columns large-pull-3 medium-pull-4">
            {% else %}
              <div class="small-12 columns">
            {% endif %}
                {{ block.sectionText }}
              </div>
            </div>
          </div>
      {% default %}
        {% set entries = block.sectionArticles %}
        {% if entries | length %}
          <div class="{{ block.backgroundColor }} page-section article-grid">
            <div class="row large-up-4 medium-up-2" data-equalizer data-equalize-on="medium">
              {% for entry in entries %}
                {% if entry.section.handle == "news" %}
                  {% include 'news/_includes/feed' %}
                {% elseif entry.section.handle == "pages" %}
                  {% include 'pages/_includes/feed' %}
                {% elseif entry.section.handle == "events" %}
                  {% include 'events/_includes/feed' %}
                {% endif %}
              {% endfor %}
            </div>
          </div>
        {% endif %}
      {% endswitch %}
  {% endfor %}
  
  ```
  
  The feed templates are just links and display fine.
  
  The errors occurs on the events/\_entry, news/\_entry and pages/\_entry templates. There is no references of the block 'sectionArticles' in those templates.
  
  One more thing: the error only happens on scheduled entries, where the Post Date is in the future, after the Post Date has arrived.
  
  **Tags:** templating, matrix, error-message, error, error-handling
  
  > **Comments:**
  > **username_1**: can you please share the template code that seems to be throwing this error?  
  > **username_2**: How is `block` getting defined in your template?  Are you looping through all of your Matrix blocks?  
  > **username_0**: I updated above to include the block and switch. After further research, it turns out that the error is thrown only when a "connectionsTextOnly" block exists.  Still doesn't answer the question of why it throws the error after you leave  
  > **username_2**: By using `{% default %}`, you're saying that every block not named `connectionsTextOnly` is going to have a `sectionArticles` field in it... is that the case?  
  > **username_0**: correct. There are only two block types.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-05-17. Score: 1
  
  Thanks everyone for taking a look. I forgot that I had implemented something on the receiving templates that allowed you to navigate between articles from the newsletter, if the referral url was the newsletter. After I implemented the text only block, I forgot to change this to ignore those blocks.
  
  
  ---
  
  