Zend certified PHP/Magento developer

Critical error in system.log – Error occurred when creating object

Error found in System.log only in Production, not in Developer Mode:
[2022-01-25 12:15:26] main.CRITICAL: Type Error occurred when creating object: AmastyPageSpeedToolsModelOutputPageTypeGetConfigPathByPageType, Argument 1 passed to AmastyPageSpeedToolsModelOutputPageTypeGetConfigPathByPageType::__construct() must be of the type string, null given, called in /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 [] []

The GetConfigPathByPageType

declare(strict_types=1);

namespace AmastyPageSpeedToolsModelOutputPageType;

use MagentoFrameworkViewLayout;

class GetConfigPathByPageType
{
/**
* @var Layout
*/
private $layout;

/**
 * @var array
 */
private $configPathsByPageType;

private $pageTypeConfigPath;

/**
 * @var string
 */
private $defaultConfigPath;

public function __construct(
    string $defaultConfigPath,
    array $configPathsByPageType,
    Layout $layout
) {
    $this->layout = $layout;
    $this->configPathsByPageType = $configPathsByPageType;
    $this->defaultConfigPath = $defaultConfigPath;
}

public function execute(string $pageType = ''): string
{
    if ($pageType) {
        return $this->configPathsByPageType[$pageType] ?? $this->defaultConfigPath;
    }

    if ($this->pageTypeConfigPath !== null) {
        return $this->pageTypeConfigPath;
    }

    $handles = $this->getPageHandles();
    foreach ($this->configPathsByPageType as $handle => $configPath) {
        if (in_array($handle, $handles)) {
            $this->pageTypeConfigPath = $configPath;
            break;
        }
    }
    if ($this->pageTypeConfigPath === null) {
        $this->pageTypeConfigPath = $this->defaultConfigPath;
    }

    return $this->pageTypeConfigPath;
}

private function getPageHandles(): array
{
    return $this->layout->getUpdate()->getHandles();
}

}

and then di.xml from PageSpeedTools/etc:

0
AmastyPageSpeedToolsModelOutputCheckIsOutputHtmlProcessor

0
AmastyPageSpeedToolsModelOutputCheckIsOutputHtmlProcessor

<type name="AmastyPageSpeedToolsModelImageReplacerCompositeInterface">
    <arguments>
        <argument name="imageReplacers" xsi:type="array">
            <item name="replace_with_best" xsi:type="object">AmastyPageSpeedToolsModelImageReplacerBestReplacer</item>
            <item name="replace_with_picture" xsi:type="object">AmastyPageSpeedToolsModelImageReplacerPictureTagReplacer</item>
        </argument>
    </arguments>
</type>

<type name="AmastyPageSpeedToolsPluginProcessPageResult">
    <arguments>
        <argument name="outputChain" xsi:type="object">AmastyPageSpeedToolsModelOutputOutputChainProxy</argument>
    </arguments>
</type>

<type name="MagentoFrameworkViewTemplateEngineFactory">
    <plugin name="Amasty_PageSpeedTools::DebugHints" type="AmastyPageSpeedToolsPluginDebugTemplateHints" sortOrder="20"/>
</type>

Could you please help me get to the bottom of this?