symfony/translation · error · RuntimeException

Please provide a filename or pipe file content to STDIN.

Error message

Please provide a filename or pipe file content to STDIN.

What it means

Sentinel error in XliffLintCommand::execute(): no filename argument was given and nothing was piped to STDIN, so there is no XLIFF input to lint. The command requires either one or more file paths/directories as the 'filename' argument or content streamed via '-'/STDIN; with neither it raises a RuntimeException.

Solutions

  1. Pass file or directory arguments: php bin/console lint:xliff translations/messages.en.xliff.
  2. Pipe content to STDIN: cat file.xliff | php bin/console lint:xliff - (or no args with stdin).
  3. In CI, ensure the file glob expands to at least one existing path before invoking the linter.
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at Command/XliffLintCommand.php:97

                EOF
            )
        ;
    }

    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
    {

View on GitHub (pinned to ae9e8a51bc)