{"record":{"id":"cc49a799a8b27132","repo":"composer/composer","slug":"no-binaries-found-in-composer-json-or-in-bin-dir","errorCode":null,"errorMessage":"No binaries found in composer.json or in bin-dir ($binDir)","messagePattern":"No binaries found in composer\\.json or in bin-dir \\(\\$binDir\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"src/Composer/Command/ExecCommand.php","lineNumber":83,"sourceCode":"            'Binary to run: ',\n            $binaries,\n            '',\n            1,\n            'Invalid binary name \"%s\"'\n        );\n\n        $input->setArgument('binary', $binaries[$binary]);\n    }\n\n    protected function execute(InputInterface $input, OutputInterface $output): int\n    {\n        $composer = $this->requireComposer();\n        if ($input->getOption('list') || null === $input->getArgument('binary')) {\n            $bins = $this->getBinaries(true);\n            if ([] === $bins) {\n                $binDir = $composer->getConfig()->get('bin-dir');\n\n                throw new \\RuntimeException(\"No binaries found in composer.json or in bin-dir ($binDir)\");\n            }\n\n            $this->getIO()->write(\n                <<<EOT\n<comment>Available binaries:</comment>\nEOT\n            );\n\n            foreach ($bins as $bin) {\n                $this->getIO()->write(\n                    <<<EOT\n<info>- $bin</info>\nEOT\n                );\n            }\n\n            return 0;\n        }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/composer/composer/blob/6ffc1177404d0c50119c22dde6564a380f4a82c9/src/Composer/Command/ExecCommand.php#L65-L101","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ncomposer exec  # No binaries found\n// after\ncomposer install\n# or vendor the tool directly\nvendor/bin/<tool>","handlingStrategy":"validation","validationCode":"$bins = glob($binDir . '/*');\nif (count($bins) === 0) {\n    // inform user / skip exec, or ensure composer install was run\n    throw new \\RuntimeException('No binaries available in ' . $binDir);\n}","typeGuard":"function hasAvailableBinaries(string $binDir): bool { return count(glob(rtrim($binDir,'/').'/*')) > 0; }","tryCatchPattern":null,"preventionTips":["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."],"tags":["exec","cli","binaries","composer-json"],"analyzedSha":"6ffc1177404d0c50119c22dde6564a380f4a82c9","analyzedAt":"2026-08-07T00:01:08.491Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}