title: Magento 2 -- debug.log -- main.DEBUG: Request validation failed for action "Vendor\Module\Controller\Index\Post\Interceptor"
body: <p>I'm implementing a Custom Module that essentially has the same functionality as the default Magento 2 Contact Form. I'm receiving a very irritating error I can't seem to find a solution to. It seems my POST request is failing Magento's request validation, but I'm not sure how to find any more specific information.</p>
  
  <p>I've attempted to implement a "CSRFSkip" plugin that bypasses the Magento CSRF validation. I've tried changing what my controller extends and implements. I've searched the logs extensively.</p>
  
  <p>Here's my Magento debug.log as the error is happening.</p>
  
  <pre><code>[2019-10-17 19:39:16] main.DEBUG: Request validation failed for action "Vendor\Module\Controller\Index\Post\Interceptor" [] []
  [2019-10-17 19:41:20] main.DEBUG: Request validation failed for action "Vendor\Module\Controller\Index\Post\Interceptor" [] []
  [2019-10-17 19:41:21] main.INFO: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  [2019-10-17 19:41:21] main.INFO: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  [2019-10-17 19:41:21] main.INFO: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
  </code></pre>
  
  <p>Here's my controller. /Vendor/Module/Controller/Index/Post.php</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace Vendor\Module\Controller\Index;
  
  use Magento\Framework\Controller\ResultFactory;
  
  class Post extends \Magento\Framework\App\Action\Action implements \Magento\Framework\App\Action\HttpPostActionInterface
  {
      /**
       * Post action
       *
       * @return void
       */
      public function execute()
      {
          $post = $this-&gt;getRequest()-&gt;getPostValue();
          if (!$post['name']) {
              $this-&gt;_redirect('/find-a-dealer');
              return;
          }
  
          $this-&gt;inlineTranslation-&gt;suspend();
          try {
              $postObject = new \Magento\Framework\DataObject();
              $postObject-&gt;setData($post);
              $error = false;
  
              $this-&gt;logger-&gt;debug($post['name']);
              if (!\Zend_Validate::is(trim($post['name']), 'NotEmpty')) {
                  $error = true;
              }
  
              $this-&gt;logger-&gt;debug($post['email']);
              if (!\Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
                  $error = true;
              }
  
              $this-&gt;logger-&gt;debug($post['city']);
              if (!\Zend_Validate::is(trim($post['city']), 'NotEmpty')) {
                  $error = true;
              }
  
              $this-&gt;logger-&gt;debug($post['state']);
              if (!\Zend_Validate::is(trim($post['state']), 'NotEmpty')) {
                  $error = true;
              }
  
              $this-&gt;logger-&gt;debug($post['zip']);
              if (!\Zend_Validate::is(trim($post['zip']), 'NotEmpty')) {
                  $error = true;
              }
  
              $this-&gt;logger-&gt;debug($post['part']);
              if (!\Zend_Validate::is(trim($post['part']), 'NotEmpty')) {
                  $error = true;
              }
  
              if ($error) {
                  throw new \Exception();
              }
  
              $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
              $transport = $this-&gt;_transportBuilder
                  -&gt;setTemplateIdentifier($this-&gt;scopeConfig-&gt;getValue(self::XML_PATH_EMAIL_TEMPLATE, $storeScope))
                  -&gt;setTemplateOptions(
                      [
                          'area' =&gt; \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
                          'store' =&gt; \Magento\Store\Model\Store::DEFAULT_STORE_ID,
                      ]
                  )
                  -&gt;setTemplateVars(['data' =&gt; $postObject])
                  -&gt;setFrom($this-&gt;scopeConfig-&gt;getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
                  -&gt;addTo($this-&gt;scopeConfig-&gt;getValue(self::XML_PATH_EMAIL_RECIPIENT, $storeScope))
                  -&gt;setReplyTo($post['email'])
                  -&gt;getTransport();
  
              $transport-&gt;sendMessage();
  
              $this-&gt;inlineTranslation-&gt;resume();
              $this-&gt;messageManager-&gt;addSuccess(
                  __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.')
              );
              $this-&gt;getDataPersistor()-&gt;clear('find-a-dealer');
              $this-&gt;_redirect('find-a-dealer');
              return;
          } catch (\Exception $e) {
              $this-&gt;inlineTranslation-&gt;resume();
              $this-&gt;messageManager-&gt;addError(
                  __('We can\'t process your request right now. Sorry, that\'s all we know.')
              );
              $this-&gt;getDataPersistor()-&gt;set('find-a-dealer', $post);
              $this-&gt;_redirect('find-a-dealer');
              return;
          }
      }
  
      /**
       * Get Data Persistor
       *
       * @return DataPersistorInterface
       */
      private function getDataPersistor()
      {
          if ($this-&gt;dataPersistor === null) {
              $this-&gt;dataPersistor = ObjectManager::getInstance()
                  -&gt;get(DataPersistorInterface::class);
          }
  
          return $this-&gt;dataPersistor;
      }
  }
  
  </code></pre>
  
  <p>I expect for my post function to run and dispatch my email.</p>
  
  <p>What actually happens is a redirect to my form page, and some validation related errors in the logs.</p>