diff --git a/Console/GenerateEncryptionKey.php b/Console/GenerateEncryptionKey.php index 6620f1a..421aeb6 100644 --- a/Console/GenerateEncryptionKey.php +++ b/Console/GenerateEncryptionKey.php @@ -105,7 +105,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int * * @see \Magento\EncryptionKey\Controller\Adminhtml\Crypt\Key\Save::execute() */ - $this->state->setAreaCode('adminhtml'); + try { + $this->state->setAreaCode('adminhtml'); + } catch (\Magento\Framework\Exception\LocalizedException $exception) { + // Area code is already set + } $this->emulation->startEnvironmentEmulation(0, 'adminhtml'); $output->writeln('Generating a new encryption key using the magento core class'); $this->changeEncryptionKey->setOutput($output);