symfony/translation · error · InvalidArgumentException
The " " file does not exist.
Error message
The "%s" file does not exist.
What it means
Thrown by AbstractFileExtractor::isFile when a path passed to the extractor is not an existing file (is_file() fails). Translation extractors (PHP, Twig) call canBeExtracted(), which calls isFile(), for every candidate path.
Solutions
- Verify every configured source path exists (`ls` each dir) and fix typos
- Update extractor path configuration after moving/renaming source directories
- Remove or repair broken symlinks inside the scanned directories
- Run extraction from the project root so relative paths resolve correctly
Example fix
// before bin/console translation:extract --dirs=src/Contollers app // after bin/console translation:extract --dirs=src/Controllers app
Defensive patterns
Strategy: validation
Validate before calling
foreach ($dirs as $dir) { if (!is_dir($dir)) { throw new \InvalidArgumentException("Extraction path does not exist: {$dir}"); } } Type guard
function isExistingFilePath(string $file): bool { return is_file($file); } Try / catch
try { $extractor->extract($directory, $catalogue); } catch (InvalidArgumentException $e) { if (str_contains($e->getMessage(), 'file does not exist')) { // fix configured path and retry } throw $e; } Prevention
- Validate all --dirs / extractor_paths entries exist before running extraction
- Use absolute paths anchored to the project root (%kernel.project_dir%)
- Clean up broken symlinks; exclude vendor/generated dirs from extraction scans
When it happens
Trigger: Running `php bin/console translation:extract` (or calling extractors directly) with source paths that don't exist — wrong --dirs values, deleted directories, path typos, or directories containing symlinks to missing files.
Common situations: Typo in the extraction directory configuration (framework.translation.extractor_paths or command --dirs); renamed/moved source folders; broken symlinks; running extraction on a machine without the full code checkout.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- The Translator does not support the following options
- The file dumper needs a path option.
- Unable to create directory
- No support implemented for dumping XLIFF version
- Dumping translations in the YAML format requires the…
AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15).
Data as JSON: /api/errors/7bec1053244c3fb0.
Report an issue: GitHub.
Appendix: source
Thrown at Extractor/AbstractFileExtractor.php:52
} else {
$files = $this->extractFromDirectory($resource);
}
return $files;
}
private function toSplFileInfo(string $file): \SplFileInfo
{
return new \SplFileInfo($file);
}
/**
* @throws InvalidArgumentException
*/
protected function isFile(string $file): bool
{
if (!is_file($file)) {
throw new InvalidArgumentException(\sprintf('The "%s" file does not exist.', $file));
}
return true;
}
abstract protected function canBeExtracted(string $file): bool;
abstract protected function extractFromDirectory(string|array $resource): iterable;
}
View on GitHub (pinned to ae9e8a51bc)