{"record":{"id":"ccbdcac9c84bfbdf","repo":"symfony/symfony","slug":"this-command-does-not-support-the-application-kern","errorCode":null,"errorMessage":"This command does not support the application kernel: \"%s\" does not extend \"%s\".","messagePattern":"This command does not support the application kernel: \"(.+?)\" does not extend \"(.+?)\"\\.","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php","lineNumber":86,"sourceCode":"\n        $io->success('The container was linted successfully: all services are injected with values that are compatible with their type declarations.');\n\n        return 0;\n    }\n\n    private function getContainerBuilder(bool $resolveEnvVars): ContainerBuilder\n    {\n        if (isset($this->container)) {\n            return $this->container;\n        }\n\n        $kernel = $this->getApplication()->getKernel();\n        $container = $kernel->getContainer();\n        $file = $kernel->isDebug() ? $container->getParameter('debug.container.dump') : false;\n\n        if (!$file || !(new ConfigCache($file, true))->isFresh()) {\n            if (!$kernel instanceof Kernel) {\n                throw new RuntimeException(\\sprintf('This command does not support the application kernel: \"%s\" does not extend \"%s\".', get_debug_type($kernel), Kernel::class));\n            }\n\n            $buildContainer = \\Closure::bind(function (): ContainerBuilder {\n                $this->initializeBundles();\n\n                return $this->buildContainer();\n            }, $kernel, $kernel::class);\n            $container = $buildContainer();\n        } else {\n            $container = unserialize(file_get_contents(substr_replace($file, '.ser', -4)), ['allowed_classes' => true]);\n\n            if (!$container instanceof ContainerBuilder) {\n                throw new RuntimeException(\\sprintf('This command does not support the application container: \"%s\" is not a \"%s\".', get_debug_type($container), ContainerBuilder::class));\n            }\n\n            if ($resolveEnvVars) {\n                $container->getCompilerPassConfig()->setOptimizationPasses([new ResolveParameterPlaceHoldersPass(), new ResolveFactoryClassPass()]);\n            } else {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php#L68-L104","documentation":"Thrown by `lint:container` when the application kernel does not extend `Symfony\\Component\\HttpKernel\\Kernel` AND the cached debug container dump is missing or stale. The command needs to rebuild the container from the kernel, which requires reflective access to the protected `initializeBundles()` and `buildContainer()` methods that only exist on the base `Kernel` class.","triggerScenarios":"Running `php bin/console lint:container` with a custom kernel class that implements `KernelInterface` directly (instead of extending `Kernel`), when the debug container dump file referenced by the `debug.container.dump` parameter is absent or not fresh.","commonSituations":"Custom micro-framework kernels, test fixtures with minimal kernel implementations, or bootstraps that replaced the standard Kernel with a lighter alternative. Also seen when the cache has been cleared in debug mode but not regenerated.","solutions":["Make your application kernel extend `Symfony\\Component\\HttpKernel\\Kernel` instead of only implementing `KernelInterface`.","Warm the cache first (`php bin/console cache:warmup`) so the debug container dump exists and is fresh.","If a custom kernel is intentional and cannot extend `Kernel`, accept that `lint:container` is unsupported in that setup."],"exampleFix":"// before\nclass MicroKernel implements KernelInterface { ... }\n\n// after\nclass MicroKernel extends \\Symfony\\Component\\HttpKernel\\Kernel\n{\n    // registerBundles(), registerContainerConfiguration() ...\n}","handlingStrategy":"validation","validationCode":"// Ensure the kernel extends the base Kernel before relying on lint:container.\nif (!($kernel instanceof \\Symfony\\Component\\HttpKernel\\Kernel)) {\n    // lint:container is unsupported; skip or warm cache first\n}","typeGuard":"function kernelSupportsLint(\\Symfony\\Component\\HttpKernel\\KernelInterface $kernel): bool\n{\n    return $kernel instanceof \\Symfony\\Component\\HttpKernel\\Kernel;\n}","tryCatchPattern":"try {\n    $exit = $command->run($input, $output);\n} catch (\\Symfony\\Component\\Console\\Exception\\RuntimeException $e) {\n    // kernel unsupported; fall back to cache:warmup or skip linting\n}","preventionTips":["Always extend `Symfony\\Component\\HttpKernel\\Kernel` in application kernels.","Warm the cache before running lint:container in custom-kernel setups."],"tags":["symfony","console","kernel","lint","configuration"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}