Zend certified PHP/Magento developer

Error in developer mode: Argument #2 ($validationState) must be of type ValidationStateInterface, null given

I get below error after I do bin/magento setup:upgrade on my local env. The only workaround I got so far is to run bin/magento setup:di:complile. After running di compile the error is gone unit I run setup:upgrade again. I am in developer mode.

What is the root problem, and how can I solve it?

1 exception(s): Exception #0
(MagentoFrameworkExceptionRuntimeException): Type Error occurred
when creating object: MagentoFrameworkConfigDom,
MagentoFrameworkConfigDom::__construct(): Argument #2
($validationState) must be of type
MagentoFrameworkConfigValidationStateInterface, null given, called
in
/data/web/application/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php
on line 121

1 exception(s):
Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoFrameworkConfigDom, MagentoFrameworkConfigDom::__construct(): Argument #2 ($validationState) must be of type MagentoFrameworkConfigValidationStateInterface, null given, called in /data/web/application/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoFrameworkConfigDom, MagentoFrameworkConfigDom::__construct(): Argument #2 ($validationState) must be of type MagentoFrameworkConfigValidationStateInterface, null given, called in /data/web/application/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121
<pre>#1 MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#2 MagentoFrameworkObjectManagerObjectManager->create() called at [vendor/magento/framework/Config/DomFactory.php:43]
#3 MagentoFrameworkConfigDomFactory->createDom() called at [vendor/magento/framework/View/Model/Layout/Update/Validator.php:141]
#4 MagentoFrameworkViewModelLayoutUpdateValidator->isValid() called at [vendor/magento/framework/View/Model/Layout/Merge.php:524]
#5 MagentoFrameworkViewModelLayoutMerge->_validateMergedLayout() called at [vendor/magento/framework/View/Model/Layout/Merge.php:500]
#6 MagentoFrameworkViewModelLayoutMerge->load() called at [generated/code/Hyva/Theme/Framework/View/Model/Layout/Merge/Interceptor.php:149]
#7 HyvaThemeFrameworkViewModelLayoutMergeInterceptor->load() called at [vendor/magento/framework/View/Layout/Builder.php:86]
#8 MagentoFrameworkViewLayoutBuilder->loadLayoutUpdates() called at [vendor/magento/framework/View/Layout/Builder.php:63]
#9 MagentoFrameworkViewLayoutBuilder->build() called at [vendor/magento/framework/View/Page/Config.php:227]
#10 MagentoFrameworkViewPageConfig->build() called at [vendor/magento/framework/View/Page/Config.php:591]
#11 MagentoFrameworkViewPageConfig->getElementAttribute() called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:248]
#12 MagentoFrameworkViewPageConfigInterceptor->getElementAttribute() called at [vendor/magento/framework/View/Page/Config.php:549]
#13 MagentoFrameworkViewPageConfig->addBodyClass() called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:230]
#14 MagentoFrameworkViewPageConfigInterceptor->addBodyClass() called at [vendor/magento/module-catalog/Controller/Category/View.php:246]
#15 MagentoCatalogControllerCategoryView->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#16 MagentoCatalogControllerCategoryViewInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#17 MagentoCatalogControllerCategoryViewInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#18 MagentoCatalogControllerCategoryViewInterceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:23]
#19 MagentoCatalogControllerCategoryViewInterceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#20 MagentoFrameworkAppActionAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#21 MagentoCatalogControllerCategoryViewInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#22 MagentoCatalogControllerCategoryViewInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 MagentoCatalogControllerCategoryViewInterceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:32]
#24 MagentoCatalogControllerCategoryViewInterceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#25 MagentoFrameworkAppFrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#26 MagentoFrameworkAppFrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#27 MagentoFrameworkAppFrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#28 MagentoFrameworkAppFrontControllerInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#29 MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#30 MagentoStoreAppFrontControllerPluginRequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#31 MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/amasty/aminvisiblecaptcha/Plugin/Framework/App/FrontControllerInterface/ValidateCaptcha.php:124]
#32 AmastyInvisibleCaptchaPluginFrameworkAppFrontControllerInterfaceValidateCaptcha->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#33 MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:75]
#34 MagentoPageCacheModelAppFrontControllerBuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#35 MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#36 MagentoFrameworkAppFrontControllerInterceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#37 MagentoFrameworkAppFrontControllerInterceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#38 MagentoFrameworkAppHttp->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#39 MagentoFrameworkAppHttpInterceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#40 MagentoFrameworkAppBootstrap->run() called at [pub/index.php:30]
</pre>