Drush command not found

Created on 26 August 2025, about 1 month ago

Problem/Motivation

With Drush 13.6.2 after enabling the module along with a module implementing a plugin, and even after repeated cache reloads, trying to run drush batch_plugin:process anything returns 'There are no commands defined in the "batch_plugin" namespace.' and trying to run drush bpp returns "Command "bpp" is not defined."

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mlncn
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Ah, Drush 13 changed things up: "Drush 13 expects commandfiles to use Autowire to inject Drupal and Drush dependencies. Prior versions used a drush.services.yml file which is now deprecated and will be removed in Drush 13."

    https://www.drush.org/13.0.0/commands/

  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    The commands can be seen and run. The main need seemed to be the drush.services.yml, which is not supposed to be needed since Drush 13, but there is documentation and then there is what actually works. I'm still getting errors ("> [warning] Undefined array key "success" batch.inc:229; [error] Error: Call to a member function claimItem() on null in _drush_batch_worker() (line 242 of /var/www/html/vendor/drush/drush/includes/batch.inc) #0 /var/www/html/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()"), but that might be with my plugin not the new Drush implementation.

  • πŸ‡¬πŸ‡§United Kingdom Dubs

    @mlncn - thanks for forking and fixing this. I've merged a modified version of your code which used a trait to allow support for older versions of drush.

    I can't see anything wrong with your plugin code. The error suggests that the item isn't there, which is odd.

    Try running this command (enable the example module), and let me know if you get the same issues. If you do, feel free to open a new issue.

    drush batch_plugin:process example_cron_batch_plugin
    

    I've tested here on a sandbox and a few sites we have live with this, and it's all good with no errors or warnings.

    Thanks again for the fix!

  • πŸ‡¬πŸ‡§United Kingdom Dubs
  • πŸ‡¬πŸ‡§United Kingdom Dubs
  • πŸ‡¬πŸ‡§United Kingdom Dubs

    @mlncn, so I couldn't help myself and downloaded your module. Tested it and I got the same error. It's because $this->operations was an empty array. I've fixed that in the Cron processor. Checkout version 2.0.5 :-)

Production build 0.71.5 2024