diff --git a/typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php b/typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php
index 01f0002fac1645a8fa39f485cea321b537c5a876..24bc35f2310d4175a03911249a877aa9ce4fa525 100644
--- a/typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php
+++ b/typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php
@@ -23,6 +23,7 @@ use TYPO3\CMS\Core\Http\HtmlResponse;
 use TYPO3\CMS\Core\LinkHandling\LinkService;
 use TYPO3\CMS\Core\Routing\InvalidRouteArgumentsException;
 use TYPO3\CMS\Core\Site\Entity\Site;
+use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Site\SiteFinder;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -107,10 +108,14 @@ class PageContentErrorHandler implements PageErrorHandlerInterface
         if (!$site instanceof Site) {
             $site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId((int)$urlParams['pageuid']);
         }
+        $language = $request->getAttribute('language', null);
+        if (!$language instanceof SiteLanguage || !$language->isEnabled()) {
+            $language = $site->getDefaultLanguage();
+        }
         // Build Url
         return (string)$site->getRouter()->generateUri(
             (int)$urlParams['pageuid'],
-            ['_language' => $request->getAttribute('language', null)]
+            ['_language' => $language]
         );
     }
 }