Fix PHP deprecation warnings by christianwach · Pull Request #5897 · wp-cli/wp-cli
Please see #5896 for details and code to replicate.
tl;dr In versions of PHP greater than 8.1.x, when WP_CLI::error() and WP_CLI::halt() are called in a separate command via WP_CLI::runcommand(), then PHP Deprecated notices are written to the logs. Passing an empty string is compatible with the signature of the Exception constructor and avoids the warnings.
Edit: since there are no functional changes in this PR, I haven't included tests.