{"record":{"id":"0a06776453686712","repo":"composer/composer","slug":"failed-to-execute-command-error-output","errorCode":null,"errorMessage":"Failed to execute {command}\n\n{error_output}","messagePattern":"Failed to execute (.+?)\n\n(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Composer/Downloader/FossilDownloader.php","lineNumber":117,"sourceCode":"\n        foreach ($this->process->splitLines($output) as $line) {\n            if (Preg::isMatch($match, $line)) {\n                break;\n            }\n            $log .= $line;\n        }\n\n        return $log;\n    }\n\n    /**\n     * @param non-empty-list<string> $command\n     * @throws RuntimeException\n     */\n    private function execute(array $command, ?string $cwd = null, ?string &$output = null): void\n    {\n        if (0 !== $this->process->execute($command, $output, $cwd)) {\n            throw new RuntimeException('Failed to execute ' . implode(' ', $command) . \"\\n\\n\" . $this->process->getErrorOutput());\n        }\n    }\n\n    /**\n     * @inheritDoc\n     */\n    protected function hasMetadataRepository(string $path): bool\n    {\n        return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');\n    }\n}\n","sourceCodeStart":99,"sourceCodeEnd":129,"githubUrl":"https://github.com/composer/composer/blob/c435d285c9120efdca35696769c72ea9fdcc0466/src/Composer/Downloader/FossilDownloader.php#L99-L129","documentation":"Thrown by FossilDownloader's private execute() helper when a Fossil command (fossil pull, fossil up, etc.) returns a non-zero exit code. The code at FossilDownloader.php:116-117 checks the ProcessExecutor result and throws a RuntimeException containing the full command and its error output. This wraps any underlying Fossil CLI failure into a Composer-level exception.","triggerScenarios":"The 'fossil' binary fails during doUpdate: 'fossil pull' fails due to network/auth issues, or 'fossil up' fails due to an invalid reference, merge conflict, or corrupt checkout. Any non-zero exit from the ProcessExecutor triggers it.","commonSituations":"The Fossil repository server is down or the URL is wrong. Network/firewall blocks the Fossil protocol. Authentication required but not configured. The checkout has uncommitted changes blocking an update. The 'fossil' binary is outdated or misconfigured.","solutions":["Read the embedded error_output in the exception message to see the Fossil CLI's diagnostic.","Run the failing fossil command manually in the package directory to reproduce and debug.","Verify network connectivity and authentication to the Fossil repository.","If the checkout has local changes, stash or revert them before updating.","Ensure the 'fossil' binary is installed, on PATH, and at a compatible version."],"exampleFix":"# before\n$ composer update vendor/fossil-pkg\n# RuntimeException: Failed to execute fossil pull\n\n# after: debug manually\n$ cd vendor/vendor/fossil-pkg\n$ fossil pull  # see actual error\n$ fossil up <ref>  # then retry composer update","handlingStrategy":"try-catch","validationCode":"// Check fossil binary availability before update\n$process = new \\Composer\\Util\\ProcessExecutor();\nif (0 !== $process->execute(['fossil', 'version'], $fossilOutput)) {\n    fwrite(STDERR, 'fossil binary not available: ' . $fossilOutput);\n    exit(1);\n}","typeGuard":"function fossilBinaryIsAvailable(\\Composer\\Util\\ProcessExecutor $process): bool {\n    return 0 === $process->execute(['fossil', 'version']);\n}","tryCatchPattern":"try {\n    $downloader->update($initial, $target, $path, $url);\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'Failed to execute fossil')) {\n        // Inspect $e->getMessage() for the fossil CLI error and retry or fix\n        fwrite(STDERR, $e->getMessage());\n    }\n    throw $e;\n}","preventionTips":["Ensure the 'fossil' binary is installed and accessible.","Verify network access and auth to the Fossil repository.","Stash or revert local changes in the checkout before updating."],"tags":["fossil","vcs","downloader","process-executor","command-failure"],"backgroundTag":null,"analyzedSha":"c435d285c9120efdca35696769c72ea9fdcc0466","analyzedAt":"2026-08-07T18:58:23.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}