Answers.Body: <p>You probably have a plugin which is listening to the <code>userSession.onLogin</code> event and trying to access the current user from the session.</p>
  
  <p>The solution is for the plugin developer to wrap the event listener to ignore console sessions like this:</p>
  
  <pre><code>    if(!craft()-&gt;isConsole())
      {
          craft()-&gt;on('userSession.onLogin',
              [
                  craft()-&gt;market_customer,
                  'loginHandler'
              ]
          );
      }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T09:39:22.767Z
Answers.LastActivityDate: 2015-09-04T09:39:22.767Z
Answers.UserDisplayName: Luke Holder
Body: <p>None of the craft core console commands to work.
  For example: <code>./yiic querygen all My_MyRecord</code> produces an error which includes mention of <code>session</code>?</p>
  
  <p>How do I get craft console commands working again?</p>
  
Tags: <console>
Title: Running a console command produces an error mentioning sessions. How do I resolve?
ThreadText: # Running a console command produces an error mentioning sessions. How do I resolve?
  
  (Asked by: username_0 on 2015-09-04)
  
  None of the craft core console commands to work.
  For example: `./yiic querygen all My_MyRecord` produces an error which includes mention of `session`?
  
  How do I get craft console commands working again?
  
  **Tags:** console
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-09-04. Score: 1 | Accepted answer
  
  You probably have a plugin which is listening to the `userSession.onLogin` event and trying to access the current user from the session.
  
  The solution is for the plugin developer to wrap the event listener to ignore console sessions like this:
  
  ```
      if(!craft()->isConsole())
      {
          craft()->on('userSession.onLogin',
              [
                  craft()->market_customer,
                  'loginHandler'
              ]
          );
      }
  
  ```
  
  
  ---
  
  