diff --git a/typo3/sysext/core/Classes/Cache/CacheManager.php b/typo3/sysext/core/Classes/Cache/CacheManager.php
index 0272037848deacbec774a5105002e022e3f51a05..ec34f469f28b2f31b824ee7ecd5c89e350fa657b 100644
--- a/typo3/sysext/core/Classes/Cache/CacheManager.php
+++ b/typo3/sysext/core/Classes/Cache/CacheManager.php
@@ -96,13 +96,19 @@ class CacheManager implements SingletonInterface
         $newConfiguration = [];
         $migratedConfiguration = [];
         foreach ($cacheConfigurations as $identifier => $configuration) {
+            if (empty($identifier)) {
+                throw new \InvalidArgumentException('A cache identifier was not set.', 1596980032);
+            }
             if (!is_array($configuration)) {
                 throw new \InvalidArgumentException('The cache configuration for cache "' . $identifier . '" was not an array as expected.', 1231259656);
             }
             // Fallback layer, will be removed in TYPO3 v11.0.
             if (strpos($identifier, 'cache_') === 0) {
-                trigger_error('Accessing a cache with the "cache_" prefix as in "' . $identifier . '" is not necessary anymore, and should be called without the cache prefix.', E_USER_DEPRECATED);
                 $identifier = substr($identifier, 6);
+                if (empty($identifier)) {
+                    throw new \InvalidArgumentException('A cache identifier was not set.', 1596980033);
+                }
+                trigger_error('Accessing a cache with the "cache_" prefix as in "' . $identifier . '" is not necessary anymore, and should be called without the cache prefix.', E_USER_DEPRECATED);
                 $migratedConfiguration[$identifier] = $configuration;
             } else {
                 $newConfiguration[$identifier] = $configuration;
diff --git a/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php b/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php
index e2ae47958f84b3b8b830a2691edea3353423174a..59fd653a4bc7e88b78b70b371eb668c2b31cc3a7 100644
--- a/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php
+++ b/typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php
@@ -537,4 +537,48 @@ class CacheManagerTest extends UnitTestCase
         $manager->setCacheConfigurations($rawConfiguration);
         self::assertEquals($expectedConfiguration, $manager->_get('cacheConfigurations'));
     }
+
+    /**
+     * @test
+     */
+    public function setCacheConfigurationsThrowsExceptionIfConfiguredCacheDoesNotHaveAnIdentifier()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1596980032);
+
+        /** @var \PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|CacheManager $manager */
+        $manager = $this->getAccessibleMock(CacheManager::class, ['dummy']);
+        $manager->setCacheConfigurations([
+            '' => [
+                'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
+                'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class,
+                'options' => [
+                    'compression' => true,
+                ],
+                'groups' => ['pages'],
+            ]
+        ]);
+    }
+
+    /**
+     * @test
+     */
+    public function setCacheConfigurationsThrowsExceptionIfMigratedConfiguredCacheDoesNotHaveAnIdentifier()
+    {
+        $this->expectException(\InvalidArgumentException::class);
+        $this->expectExceptionCode(1596980033);
+
+        /** @var \PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|CacheManager $manager */
+        $manager = $this->getAccessibleMock(CacheManager::class, ['dummy']);
+        $manager->setCacheConfigurations([
+            'cache_' => [
+                'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
+                'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class,
+                'options' => [
+                    'compression' => true,
+                ],
+                'groups' => ['pages'],
+            ]
+        ]);
+    }
 }