I have around 1200 large images which I'd like to regenerate. I'm using the WP-CLI command wp media regenerate. After around 61 images are generated, the terminal shows the message Killed.

enter image description here

Why is this happening and how can I fix it?

  • If the kernel killed it there will probably be an entry in /var/log/messages. – Rup Apr 8 '19 at 10:49

Which version of WP-CLI are you using? What is wp --version returning you?

Seems a little bit that you may be running out of memory as this is quite a large amount of images and there doesn't seem some proper batch processing implemented in version 1 of WP-CLI. At least, that's how I'd understand this issue WP-CLI issue Clear WP object cache periodically on media regenerate/import which I found in the WP-CLI v2.0.0 Release Notes.

Is upgrading WP-CLI an option for you? If not you could also install it as a project-local dependency using Composer. Maybe you need to init a bare bone Composer project with composer init in your WordPress folder first.

$ cd /path/to/wordpress
$ composer require wp-cli/wp-cli-bundle:^2
$ vendor/bin/wp media regenerate
  • I'm using WP-CLI 2.0.1. I'm running this through Local by Flywheel, so maybe there's a limit within their pre set environment. – Sam Apr 8 '19 at 10:18
  • And you tried $ wp media regenerate --yes as well? What is $ wp media regenerate --debug returning you? Can you paste that in your question, please? Although I guess this should be filed to github.com/wp-cli/media-command/issues now. – leymannx Apr 8 '19 at 10:25

Had the same problem. wp media regenerate would always get stuck at the same point with the Killed message, even with the --only-missing option.

In my case it was always after ID 571, so I tried wp media regenerate 570, which was the next one, and it also failed with the same message. So I deleted this image from the media library and now it's working.

By the way, adding --debug wouldn't give any hint about the problem. I also couldn't find any PHP logs about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.