composer/composer · warning · RuntimeException
No binaries found in composer.json or in bin-dir ($binDir)
Error message
No binaries found in composer.json or in bin-dir ($binDir)
What it means
Thrown by ExecCommand::execute() when listing or running binaries and getBinaries(true) returns an empty array — i.e. composer.json defines no `bin` entries and the configured bin-dir contains no executables.
Source
Thrown at src/Composer/Command/ExecCommand.php:83
'Binary to run: ',
$binaries,
'',
1,
'Invalid binary name "%s"'
);
$input->setArgument('binary', $binaries[$binary]);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$composer = $this->requireComposer();
if ($input->getOption('list') || null === $input->getArgument('binary')) {
$bins = $this->getBinaries(true);
if ([] === $bins) {
$binDir = $composer->getConfig()->get('bin-dir');
throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
}
$this->getIO()->write(
<<<EOT
<comment>Available binaries:</comment>
EOT
);
foreach ($bins as $bin) {
$this->getIO()->write(
<<<EOT
<info>- $bin</info>
EOT
);
}
return 0;
}View on GitHub (pinned to 6ffc117740)
Solutions
- Run `composer install` first to populate vendor/bin with dependency-provided binaries.
- Check composer.json for a `bin` section; add your executable there if you intend to expose one.
- Verify the configured bin-dir (config.bin-dir) and look inside it directly.
Example fix
// before composer exec # No binaries found // after composer install # or vendor the tool directly vendor/bin/<tool>
Defensive patterns
Strategy: validation
Validate before calling
$bins = glob($binDir . '/*');
if (count($bins) === 0) {
// inform user / skip exec, or ensure composer install was run
throw new \RuntimeException('No binaries available in ' . $binDir);
} Type guard
function hasAvailableBinaries(string $binDir): bool { return count(glob(rtrim($binDir,'/').'/*')) > 0; } Prevention
- Run `composer install` before `composer exec` to populate vendor/bin.
- Declare project executables under the `bin` key in composer.json.
- Verify the bin-dir config value if binaries live elsewhere.
When it happens
Trigger: Running `composer exec` or `composer exec --list` in a project whose composer.json has no `bin` key and whose vendor/bin (or custom bin-dir) is empty.
Common situations: Calling composer exec expecting a project-provided tool that was never declared as a bin, running in a project that only consumes libraries, or running before `composer install` populated the bin-dir.
Related errors
- "%s" is an invalid value'.($validation ? ' ('.$validation.')
- %s is an invalid value'.($validation ? ' ('.$validation.')'
- Not enough arguments (missing: "packages").
- Invalid working directory specified, {workingDir} does not e
- {package} has an invalid bin {bin}, it must not contain ".."
AI-assisted analysis of composer/composer@6ffc117740 (2026-08-07).
Data as JSON: /api/errors/cc49a799a8b27132.
Report an issue: GitHub.