diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php
index e18dcc5ff8ef0..103232ca49dbb 100644
--- a/lib/private/Console/Application.php
+++ b/lib/private/Console/Application.php
@@ -96,7 +96,7 @@ public function loadCommands(
try {
$this->loadCommandsFromInfoXml($info['commands']);
} catch (\Throwable $e) {
- $output->writeln('' . $e->getMessage() . '');
+ $output->getErrorOutput()->writeln('' . $e->getMessage() . '');
$this->logger->error($e->getMessage(), [
'exception' => $e,
]);
@@ -118,7 +118,7 @@ public function loadCommands(
try {
$this->loadCommandsFromInfoXml($info['commands']);
} catch (\Throwable $e) {
- $output->writeln('' . $e->getMessage() . '');
+ $output->getErrorOutput()->writeln('' . $e->getMessage() . '');
$this->logger->error($e->getMessage(), [
'exception' => $e,
]);