symfony/translation · error · InvalidArgumentException
" " is neither an enabled bundle nor a directory.
Error message
"%s" is neither an enabled bundle nor a directory.
What it means
Validation guard in TranslationDebugCommand::execute(): the value passed to the 'bundle' argument is neither the name of a bundle registered in the kernel nor an existing filesystem directory, so no translation/code paths can be derived from it. Fires when the argument contains a typo, a bundle that is not enabled, or a path that does not exist.
Solutions
- Pass the exact bundle name as registered in the kernel, e.g. 'AppBundle' or the full class name 'App\AppBundle'.
- Pass an existing directory that contains the translations/views layout instead of a bundle name.
- Run `php bin/console debug:router`-style discovery: use `php bin/console debug:container --parameter=kernel.bundles` (or list bundles via debug:config) to confirm the bundle is enabled.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at Command/TranslationDebugCommand.php:151 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15).
Data as JSON: /api/errors/63a119ca904c09ea.
Report an issue: GitHub.
Appendix: source
Thrown at Command/TranslationDebugCommand.php:151
$bundle = $kernel->getBundle($input->getArgument('bundle'));
$bundleDir = $bundle->getPath();
$transPaths = [is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundleDir.'/translations'];
$codePaths = [is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundleDir.'/templates'];
if ($this->defaultTransPath) {
$transPaths[] = $this->defaultTransPath;
}
if ($this->defaultViewsPath) {
$codePaths[] = $this->defaultViewsPath;
}
} catch (\InvalidArgumentException) {
// such a bundle does not exist, so treat the argument as path
$path = $input->getArgument('bundle');
$transPaths = [$path.'/translations'];
$codePaths = [$path.'/templates'];
if (!is_dir($transPaths[0])) {
throw new InvalidArgumentException(\sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
}
}
} elseif ($input->getOption('all')) {
foreach ($kernel->getBundles() as $bundle) {
$bundleDir = $bundle->getPath();
$transPaths[] = is_dir($bundleDir.'/Resources/translations') ? $bundleDir.'/Resources/translations' : $bundle->getPath().'/translations';
$codePaths[] = is_dir($bundleDir.'/Resources/views') ? $bundleDir.'/Resources/views' : $bundle->getPath().'/templates';
}
}
// Extract used messages
$extractedCatalogue = $this->extractMessages($locale, $codePaths);
// Load defined messages
$currentCatalogue = $this->loadCurrentMessages($locale, $transPaths);
// Merge defined and extracted messages to get all message ids
$mergeOperation = new MergeOperation($extractedCatalogue, $currentCatalogue);View on GitHub (pinned to ae9e8a51bc)