Title: WP-CLI &#8211; Fatal error: Cannot redeclare class Debug_Bar
Last modified: August 31, 2016

---

# WP-CLI – Fatal error: Cannot redeclare class Debug_Bar

 *  [Jesse Graupmann](https://wordpress.org/support/users/jgraup/)
 * (@jgraup)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/wp-cli-fatal-error-cannot-redeclare-class-debug_bar/)
 * I’m getting the following error when installing through WP-CLI:
 *     ```
       vagrant@example:/vagrant/site$ wp plugin install debug-bar --activate
       Installing Debug Bar (0.8.2)
       Downloading install package from https://downloads.wordpress.org/plugin/debug-bar.0.8.2.zip...
       Unpacking the package...
       Installing the plugin...
       Plugin installed successfully.
       Success: Translations updates are not needed for the 'English (US)' locale.
       Activating 'debug-bar'...
       PHP Fatal error:  Cannot redeclare class Debug_Bar in /vagrant/site/wp-content/plugins/debug-bar/debug-bar.php on line 20
       <br /><b>Fatal error</b>: Cannot redeclare class Debug_Bar in <b>/vagrant/site/wp-content/plugins/debug-bar/debug-bar.php</b> on line <b>20</b><br />vagrant@example:/vagrant/site$
       ```
   
 *     ```
       vagrant@example:/vagrant/site$ wp plugin activate debug-bar
       PHP Fatal error:  Cannot redeclare class Debug_Bar in /vagrant/site/wp-content/plugins/debug-bar/debug-bar.php on line 20
       <br /><b>Fatal error</b>: Cannot redeclare class Debug_Bar in <b>/vagrant/site/wp-content/plugins/debug-bar/debug-bar.php</b> on line <b>20</b><br />vagrant@example:/vagrant/site$
       ```
   
 * But it seems like the easy fix is to just wrap the class in:
 *     ```
       if ( !class_exists('Debug_Bar')):
       //...
       endif;
       ```
   
 * With that, it activates and deactivates normally.
 *     ```
       vagrant@example:/vagrant/site$ wp plugin activate debug-bar
       Success: Plugin 'debug-bar' activated.
       vagrant@example:/vagrant/site$ wp plugin deactivate debug-bar
       Success: Plugin 'debug-bar' deactivated.
       ```
   
 * [https://wordpress.org/plugins/debug-bar/](https://wordpress.org/plugins/debug-bar/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * (@jrf)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/wp-cli-fatal-error-cannot-redeclare-class-debug_bar/#post-9254394)
 * The only reason you should get that error, is that the plugin is already active.
   Could it be that the vagrant box you use comes with the Debug Bar plugin set 
   up in the must-use plugins by default ?

Viewing 1 replies (of 1 total)

The topic ‘WP-CLI – Fatal error: Cannot redeclare class Debug_Bar’ is closed to 
new replies.

 * ![](https://ps.w.org/debug-bar/assets/icon.svg?rev=3050748)
 * [Debug Bar](https://wordpress.org/plugins/debug-bar/)
 * [Support Threads](https://wordpress.org/support/plugin/debug-bar/)
 * [Active Topics](https://wordpress.org/support/plugin/debug-bar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/debug-bar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/debug-bar/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Juliette Reinders Folmer](https://wordpress.org/support/users/jrf/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/wp-cli-fatal-error-cannot-redeclare-class-debug_bar/#post-9254394)
 * Status: not resolved