Fatal error: Uncaught TypeError: closedir()

As per the recommendation of my web host, I turned off WP-Cron and runs an hourly cron job instead (which is a service provided by my web host). One result of this is that I am sent warning and error messages in email, even about some issues that would normally go unnoticed.

Since yesterday, I started getting the following email every hour, on each one of the CP sites I’m building:

/usr/local/bin/wp cron event run --due-now
--path=/home/public/www.arjayarana.xyz --quiet --no-color

completed at 2022-05-30 22:00:47 UTC after 4 seconds and produced the
following output:

Fatal error: Uncaught TypeError: closedir(): Argument #1 ($dir_handle) must
be of type resource or null, bool given in
/home/public/www.arjayarana.xyz/wp-admin/includes/file.php:168
Stack trace:
#0 /home/public/www.arjayarana.xyz/wp-admin/includes/file.php(168):
closedir(false)
#1 /home/public/www.arjayarana.xyz/wp-includes/functions.php(6198):
list_files('/home/public/ww...', 100, Array)
#2 /home/public/www.arjayarana.xyz/wp-includes/class-wp-hook.php(286):
wp_privacy_delete_old_export_files()
#3 /home/public/www.arjayarana.xyz/wp-includes/class-wp-hook.php(310):
WP_Hook->apply_filters('', Array)
#4 /home/public/www.arjayarana.xyz/wp-includes/plugin.php(515):
WP_Hook->do_action(Array)
#5
phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(343):
do_action_ref_array('wp_privacy_dele...', Array)
#6
phar:///usr/local/bin/wp/vendor/wp-cli/cron-command/src/Cron_Event_Command.php(265):
Cron_Event_Command::run_event(Object(stdClass))
#7 [internal function]: Cron_Event_Command->run(Array, Array)
#8
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100):
call_user_func(Array, Array, Array)
#9 [internal function]:
WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#10
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491):
call_user_func(Object(Closure), Array, Array)
#11
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(417):
WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#12
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(440):
WP_CLI\Runner->run_command(Array, Array)
#13
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1237):
WP_CLI\Runner->run_command_and_exit()
#14
phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28):
WP_CLI\Runner->start()
#15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78):
WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#16 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27):
WP_CLI\bootstrap()
#17 phar:///usr/local/bin/wp/php/boot-phar.php(11):
include('phar:///usr/loc...')
#18 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#19 {main}
  thrown in /home/public/www.arjayarana.xyz/wp-admin/includes/file.php on
line 168
/usr/local/bin/wp cron event run --due-now
--path=/home/public/www.arjayarana.xyz --quiet --no-color exited with
return code 255

I performed a recent upgrade to CP version 1.4.1, but based on the timing of the emails I got, this error started before I made the upgrade.

But as far as I can tell, by logging into the site and making a test post, “everything” is working fine.

2 posts were merged into an existing topic: CRITICAL Uncaught TypeError: