symfony/translation · error · RuntimeException

File or directory " " is not readable.

Error message

File or directory "%s" is not readable.

What it means

Readability guard in XliffLintCommand::execute(): one of the paths given as the 'filename' argument exists but cannot be read by the current user (or does not exist / is not a regular readable file), so the linter cannot open the XLIFF input and raises a RuntimeException instead of silently skipping it.

Solutions

  1. Fix filesystem permissions (chmod/chown) so the user running the command can read the file or directory.
  2. Verify the path is correct relative to the working directory of the process.
  3. Exclude unreadable files from the argument list, or run the command as a user with read access.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at Command/XliffLintCommand.php:103 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/de13603262657ddd. Report an issue: GitHub.

Appendix: source

Thrown at Command/XliffLintCommand.php:103

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new SymfonyStyle($input, $output);
        $filenames = (array) $input->getArgument('filename');
        $this->format = $input->getOption('format') ?? (GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt');
        $this->displayCorrectFiles = $output->isVerbose();

        if (['-'] === $filenames) {
            return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]);
        }

        if (!$filenames) {
            throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
        }

        $filesInfo = [];
        foreach ($filenames as $filename) {
            if (!$this->isReadable($filename)) {
                throw new RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename));
            }

            foreach ($this->getFiles($filename) as $file) {
                $filesInfo[] = $this->validate(file_get_contents($file), $file);
            }
        }

        return $this->display($io, $filesInfo);
    }

    private function validate(string $content, ?string $file = null): array
    {
        $errors = [];

        // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input
        if ('' === trim($content)) {
            return ['file' => $file, 'valid' => true];
        }

View on GitHub (pinned to ae9e8a51bc)