{"record":{"id":"d44771dcf2159c5e","repo":"symfony/process","slug":"expected-a-process-that-failed-during-startup-but-the-given","errorCode":null,"errorMessage":"Expected a process that failed during startup, but the given process was started successfully.","messagePattern":"Expected a process that failed during startup, but the given process was started successfully\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Exception/ProcessStartFailedException.php","lineNumber":26,"sourceCode":" * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace Symfony\\Component\\Process\\Exception;\n\nuse Symfony\\Component\\Process\\Process;\n\n/**\n * Exception for processes failed during startup.\n */\nclass ProcessStartFailedException extends ProcessFailedException\n{\n    public function __construct(\n        private Process $process,\n        ?string $message,\n    ) {\n        if ($process->isStarted()) {\n            throw new InvalidArgumentException('Expected a process that failed during startup, but the given process was started successfully.');\n        }\n\n        $error = \\sprintf('The command \"%s\" failed.'.\"\\n\\nWorking directory: %s\\n\\nError: %s\",\n            $process->getCommandLine(),\n            $process->getWorkingDirectory(),\n            $message ?? 'unknown'\n        );\n\n        // Skip parent constructor\n        RuntimeException::__construct($error);\n    }\n\n    public function getProcess(): Process\n    {\n        return $this->process;\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/Exception/ProcessStartFailedException.php#L8-L44","documentation":"Guard in ProcessStartFailedException::__construct: this exception is meant for processes that never started. If the given Process was already started successfully, the caller has the wrong exception type and an InvalidArgumentException is thrown instead.","triggerScenarios":"Thrown at Exception/ProcessStartFailedException.php:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only construct ProcessStartFailedException when $process->isStarted() is false","Use ProcessFailedException for processes that started but later failed","Inspect the Process state before choosing which Process exception to throw"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}