Answers.Body: <p>I came across this <code>Could not find the task component type.</code> error upon trying to add a secondary task to my plugin.</p>
  
  <p>Following the naming scheme that P&amp;T have in the PowerNap plugin, try making sure you have one task named after the plugin itself <code>WassermanNewsTask</code>, and then follow the subtasks, or any other additional tasks, with the underscore naming, eg. <code>WassermanNews_TwitterTask</code>.</p>
  
  <p>There's not really any thorough documentation on Tasks, so I can't verify this is the problem, but this is what worked for me.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-03T23:00:22.773Z
Answers.LastActivityDate: 2016-01-03T23:00:22.773Z
Answers.UserDisplayName: Chase Giunta
Answers.Body: <p>I've encountered this problem before, and it seemed to be solved by replacing</p>
  
  <pre><code>return $this-&gt;runSubTask('WassermanNews_TwitterTask');
  </code></pre>
  
  <p>with </p>
  
  <pre><code>return $this-&gt;runSubTask('WassermanNews_Twitter');
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-31T15:29:39.447Z
Answers.Text: The naming convention trips me up all the time, this reminded me.
Answers.UserDisplayName: Brad
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-03T18:17:01.133Z
Answers.LastActivityDate: 2016-05-03T18:23:35.847Z
Answers.LastEditDate: 2016-05-03T18:23:35.847Z
Answers.UserDisplayName: Michael Skutt
Answers.Body: <pre><code>public function runStep($step)
  </code></pre>
  
  <p>the $step starts from 0 btw</p>
  
  <p>And be sure to return true in all tasks, if everything works fine</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-03T23:51:58.447Z
Answers.LastActivityDate: 2018-02-03T23:51:58.447Z
Answers.UserDisplayName: Simon Franzen
Body: <p>I am trying to debug a failed task in craft.  However I'm not really sure what I'm looking for.  I've dug though the log files and found traces of the task but no real errors to speak of.  I have set:</p>
  
  <pre><code>'runTasksAutomatically' =&gt; false,
  </code></pre>
  
  <p>in my general.php file so that when I create my task:</p>
  
  <pre><code>craft()-&gt;tasks-&gt;createTask('WassermanNews_SocialTask');
  craft()-&gt;end();
  </code></pre>
  
  <p>it will become a pending task rather than run automatically. That part seems to work as I end up with a pending task in my control panel. </p>
  
  <p><a href="https://i.sstatic.net/Y2a8w.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y2a8w.png" alt="enter image description here"></a></p>
  
  <p>So I think I've got the process up to this point.  From here I'd simply like to kick off that pending process which I am attempting to do by though cURL.</p>
  
  <pre><code>curl -H "X-Requested-With: XMLHttpRequest" myurl.dev:32769/actions/tasks/runPendingTasks
  </code></pre>
  
  <p>I know that this is firing because the tasks moves from a pending state to a failed state:</p>
  
  <p><a href="https://i.sstatic.net/jXQwM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jXQwM.png" alt="enter image description here"></a></p>
  
  <p>However as I previously mentioned I have no idea why the task is failing and the logs do not seem to be my friend today.  </p>
  
  <p>Any ideas on what I could be doing wrong/where I could look for errors?</p>
  
  <p>Below is my task which should be firing (it fires 1 subTask):</p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  class WassermanNews_SocialTask extends BaseTask
  {
    $TWITTER = 1;
    $INSTAGRAM = 2;
    $VINE = 3;
  
    public function getDescription()
    {
      return 'Social Grab';
    }
  
    public function getTotalSteps()
    {
      return 3;
    }
  
    public function runStep($step)
    { 
      WassermanNewsPlugin::log("Social Grab stepz izz happening",LogLevel::Info);
  
      switch($step){
          case TWITTER:
              return $this-&gt;runSubTask('WassermanNews_TwitterTask');
          case INSTAGRAM;
              return $this-&gt;runSubTask('WassermanNews_InstagramTask');
          case VINE:
              return $this-&gt;runSubTask('WassermanNews_VineTask');
      }
    }
  }
  </code></pre>
  
  <p>All the sub tasks look more or less identical to this:</p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  class WassermanNews_TwitterTask extends BaseTask
  {
    public function getDescription()
    {
      return 'Twitter Task';
    }
  
    public function getTotalSteps()
    {
      return 1;
    }
  
    public function runStep($step)
    {
      return "twitter step";
    }
  }
  </code></pre>
  
  <p>Any help figuring this out would be much appreciated!</p>
  
  <p>UPDATE:  </p>
  
  <ol>
  <li><p>I just attempted to run the an example and it failed as well.  Do certain settings affect how tasks are run?</p></li>
  <li><p>Installed PixelAndTonic's <a href="https://github.com/pixelandtonic/PowerNap" rel="nofollow noreferrer">Power Nap</a> and it failed as well!  I did however find a log for this example saying: </p>
  
  <p><code>Encountered an error running task 95 (PowerNap): Could not find the task component type.</code></p></li>
  </ol>
  
  <p>This makes me wonder what the type of the task has to be!  I took a look in TasksService.php and saw that the error is derived from not having a type so what type do tasks need to have?</p>
  
  <p><a href="https://i.sstatic.net/NJPoQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NJPoQ.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-23T18:48:32.650Z
Comments.Text: I'm playing with Tasks too, currently. How are you running the Power Nap task? It's working fine for me. Also, not sure what the "type" error is referring to, but to my knowledge I'm not setting a type in my task, nor is one set in Power Nap.
Comments.UserDisplayName: Chase Giunta
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-23T18:50:47.043Z
Comments.Text: I just added it to my plugins folder and then once I Installed it, I navigated to http://myurl.dev/actions/powerNap/start to trigger the task
Comments.UserDisplayName: 9er
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-23T20:10:28.197Z
Comments.Text: If you enable devMode and check `craft/storage/runtime/logs` are you not getting any task related error message?
Comments.UserDisplayName: Brad Bell
Tags: <tasks>
Title: Debugging a Failed Custom Task in Craft CMS
ThreadText: # Debugging a Failed Custom Task in Craft CMS
  
  (Asked by: username_0 on 2015-12-23)
  
  I am trying to debug a failed task in craft. However I'm not really sure what I'm looking for. I've dug though the log files and found traces of the task but no real errors to speak of. I have set:
  
  ```
  'runTasksAutomatically' => false,
  
  ```
  
  in my general.php file so that when I create my task:
  
  ```
  craft()->tasks->createTask('WassermanNews_SocialTask');
  craft()->end();
  
  ```
  
  it will become a pending task rather than run automatically. That part seems to work as I end up with a pending task in my control panel.
  
  [![enter image description here](https://i.sstatic.net/Y2a8w.png)](https://i.sstatic.net/Y2a8w.png)
  
  So I think I've got the process up to this point. From here I'd simply like to kick off that pending process which I am attempting to do by though cURL.
  
  ```
  curl -H "X-Requested-With: XMLHttpRequest" myurl.dev:32769/actions/tasks/runPendingTasks
  
  ```
  
  I know that this is firing because the tasks moves from a pending state to a failed state:
  
  [![enter image description here](https://i.sstatic.net/jXQwM.png)](https://i.sstatic.net/jXQwM.png)
  
  However as I previously mentioned I have no idea why the task is failing and the logs do not seem to be my friend today.
  
  Any ideas on what I could be doing wrong/where I could look for errors?
  
  Below is my task which should be firing (it fires 1 subTask):
  
  ```
  <?php
  namespace Craft;
  
  class WassermanNews_SocialTask extends BaseTask
  {
    $TWITTER = 1;
    $INSTAGRAM = 2;
    $VINE = 3;
  
    public function getDescription()
    {
      return 'Social Grab';
    }
  
    public function getTotalSteps()
    {
      return 3;
    }
  
    public function runStep($step)
    { 
      WassermanNewsPlugin::log("Social Grab stepz izz happening",LogLevel::Info);
  
      switch($step){
          case TWITTER:
              return $this->runSubTask('WassermanNews_TwitterTask');
          case INSTAGRAM;
              return $this->runSubTask('WassermanNews_InstagramTask');
          case VINE:
              return $this->runSubTask('WassermanNews_VineTask');
      }
    }
  }
  
  ```
  
  All the sub tasks look more or less identical to this:
  
  ```
  <?php
  namespace Craft;
  
  class WassermanNews_TwitterTask extends BaseTask
  {
    public function getDescription()
    {
      return 'Twitter Task';
    }
  
    public function getTotalSteps()
    {
      return 1;
    }
  
    public function runStep($step)
    {
      return "twitter step";
    }
  }
  
  ```
  
  Any help figuring this out would be much appreciated!
  
  UPDATE:
  
  1. I just attempted to run the an example and it failed as well. Do certain settings affect how tasks are run?
  2. Installed PixelAndTonic's [Power Nap](https://github.com/pixelandtonic/PowerNap) and it failed as well! I did however find a log for this example saying:
  
     `Encountered an error running task 95 (PowerNap): Could not find the task component type.`
  
  This makes me wonder what the type of the task has to be! I took a look in TasksService.php and saw that the error is derived from not having a type so what type do tasks need to have?
  
  [![enter image description here](https://i.sstatic.net/NJPoQ.png)](https://i.sstatic.net/NJPoQ.png)
  
  **Tags:** tasks
  
  > **Comments:**
  > **username_1**: I'm playing with Tasks too, currently. How are you running the Power Nap task? It's working fine for me. Also, not sure what the "type" error is referring to, but to my knowledge I'm not setting a type in my task, nor is one set in Power Nap.  
  > **username_0**: I just added it to my plugins folder and then once I Installed it, I navigated to http://myurl.dev/actions/powerNap/start to trigger the task  
  > **username_2**: If you enable devMode and check `craft/storage/runtime/logs` are you not getting any task related error message?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-01-03. Score: 4
  
  I came across this `Could not find the task component type.` error upon trying to add a secondary task to my plugin.
  
  Following the naming scheme that P&T have in the PowerNap plugin, try making sure you have one task named after the plugin itself `WassermanNewsTask`, and then follow the subtasks, or any other additional tasks, with the underscore naming, eg. `WassermanNews_TwitterTask`.
  
  There's not really any thorough documentation on Tasks, so I can't verify this is the problem, but this is what worked for me.
  
  
  ---
  
  ### Answer by username_3 on 2016-05-03. Score: 4
  
  I've encountered this problem before, and it seemed to be solved by replacing
  
  ```
  return $this->runSubTask('WassermanNews_TwitterTask');
  
  ```
  
  with
  
  ```
  return $this->runSubTask('WassermanNews_Twitter');
  
  ```
  
  > **Comments:**
  > **username_4**: The naming convention trips me up all the time, this reminded me.  
  
  ---
  
  ### Answer by username_5 on 2018-02-03. Score: 0
  
  ```
  public function runStep($step)
  
  ```
  
  the $step starts from 0 btw
  
  And be sure to return true in all tasks, if everything works fine
  
  
  ---
  
  