diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php
index 781ec62df45b0..d2695e901d947 100644
--- a/lib/private/Console/Application.php
+++ b/lib/private/Console/Application.php
@@ -95,7 +95,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,
]);
@@ -117,7 +117,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,
]);