Drupal-console: Error: Undefined index: statistics in Drupal\Console\Core\EventSubscriber\SaveStatisticsListener->saveStatistics()

Created on 14 Jun 2019  路  8Comments  路  Source: hechoendrupal/drupal-console

After upgrading to Drupal Console 1.9 release, I got two errors on each Drupal console, even via simple drupal run without arguments. Here is output

 [ERROR] <em class="placeholder">Notice</em>: Undefined index: statistics in <em                                        
         class="placeholder">Drupal\Console\Core\EventSubscriber\SaveStatisticsListener-&gt;saveStatistics()</em> (line 
         <em class="placeholder">78</em> of <em                                                                         
         class="placeholder">vendor/drupal/console-core/src/EventSubscri
         ber/SaveStatisticsListener.php</em>). <pre                                                                     
         class="backtrace">Drupal\Console\Core\EventSubscriber\SaveStatisticsListener-&gt;saveStatistics(Object,        
         &#039;console.terminate&#039;, Object) (Line: 212)                                                             
         Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch(Array, &#039;console.terminate&#039;, Object) 
         (Line: 44)                                                                                                     
         Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch(&#039;console.terminate&#039;, Object) (Line:   
         1014)                                                                                                          
         Symfony\Component\Console\Application-&gt;doRunCommand(Object, Object, Object) (Line: 255)                     
         Symfony\Component\Console\Application-&gt;doRun(Object, Object) (Line: 188)                                    
         Drupal\Console\Core\Application-&gt;doRun(Object, Object) (Line: 64)                                           
         Drupal\Console\Application-&gt;doRun(Object, Object) (Line: 148)                                               
         Symfony\Component\Console\Application-&gt;run() (Line: 89)                                                     
         require(&#039;vendor/drupal/console/bin/drupal.php&#039;)      
         (Line: 4)                                                                                                      
         </pre>                                                                                                         



 [ERROR] <em class="placeholder">Notice</em>: Undefined index: statistics in <em                                        
         class="placeholder">Drupal\Console\Core\EventSubscriber\SendStatisticsListener-&gt;calculateStatistics()</em>  
         (line <em class="placeholder">71</em> of <em                                                                   
         class="placeholder">vendor/drupal/console-core/src/EventSubscri
         ber/SendStatisticsListener.php</em>). <pre                                                                     
         class="backtrace">Drupal\Console\Core\EventSubscriber\SendStatisticsListener-&gt;calculateStatistics(Object,   
         &#039;console.terminate&#039;, Object) (Line: 212)                                                             
         Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch(Array, &#039;console.terminate&#039;, Object) 
         (Line: 44)                                                                                                     
         Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch(&#039;console.terminate&#039;, Object) (Line:   
         1014)                                                                                                          
         Symfony\Component\Console\Application-&gt;doRunCommand(Object, Object, Object) (Line: 255)                     
         Symfony\Component\Console\Application-&gt;doRun(Object, Object) (Line: 188)                                    
         Drupal\Console\Core\Application-&gt;doRun(Object, Object) (Line: 64)                                           
         Drupal\Console\Application-&gt;doRun(Object, Object) (Line: 148)                                               
         Symfony\Component\Console\Application-&gt;run() (Line: 89)                                                     
         require(&#039;vendor/drupal/console/bin/drupal.php&#039;)      
         (Line: 4)                                                                                                      
         </pre>   

All seems works well, but those errors are annoying. What does they mean and how to fix them?

Most helpful comment

Thanks @ndouglas The next release will fix it.

All 8 comments

@MurzNN thanks for your report.

We couldn't reproduce your error, could you help us with the following info

  • Drupal Launcer version
  • Drupal Console version
  • Drupal Consolre core version
  • Cppy the content of you config.yml here, remember, could be in your Drupal-Directory/.console/ or ~/.console

To try to fix your error I recommend you run the command drupal init -f to force to overwrite your config, but please rescue your current setup before to help us to fix and improve Drupal Console.

All versions are 1.9:

$ drupal --version
Drupal Console version 1.9.0

$ /usr/local/bin/drupal --version
Drupal Console version 1.9.0

$ vendor/drupal/console/bin/drupal --version
Drupal Console version 1.9.0

Drupal Console core version (from `composer.json`) - "drupal/console": "1.9",
Drupal: "drupal/core": "^8.6",

~/.console/config.yml

application:
  environment: 'prod'
  language: 'en'
#  editor: 'vim'
  temp: '/tmp'
  develop: 'false'
  command: 'list'
  checked: 'false'
  clear: 'false'
  extras:
    alias: 'true'
    extend: 'true'
    config: 'true'
    chains: 'true'
    mappings: 'true'
  overrides:
    config:
      skip-validate-site-uuid: true
  remote:
    port: '22'
    user: 'drupal'
    type: 'ssh'
  options:
    learning: false
#    target: 'site-alias.dev'
#    uri: 'multi-site.dev'
    generate-inline: false
    generate-chain: false

Hi @MurzNN, I couldn't reproduce this issue, but I added an extra validation to avoid future issues like this one.

It will be available in the next version 1.9.1 (in a month). But if you want to try this, you need to set up a development environment.

Here a guide to set up a development environment:
Choose the repos, You only need the console and the console-core
https://docs.drupalconsole.com/en/contributing/getting-the-project.html

finally, following this guide to finish:
https://docs.drupalconsole.com/en/contributing/running-the-project.html

If you have questions, let me know. @MurzNN

I had the same issue. I added these lines to config.yml -- after seeing what changed after a drupal init -- and it went away:

  statistics:
    enabled: true
    url: 'https://drupalconsole.com/statistics?_format=json'
    last-attempted: ~
    times-attempted: 0

Thanks @ndouglas The next release will fix it.

@harold20 is this fixed?

Yes @jmolivas it was fixed

Yes, fixed!

Was this page helpful?
0 / 5 - 0 ratings