symfony/process · error · RuntimeException
Enabling output while the process is running is not…
Error message
Enabling output while the process is running is not possible.
What it means
enableOutput() throws this RuntimeException when the process is currently running. Like disableOutput(), toggling output capture is only allowed while the process is not started, because stream wiring is fixed at start time.
Solutions
- Call enableOutput() before start()/run().
- Wait for the process to finish (wait()) or stop it before enabling output.
- Recreate and restart the process with output enabled.
Example fix
// before $process->start(); $process->enableOutput(); // RuntimeException // after $process->enableOutput(); $process->start();
Defensive patterns
Strategy: validation
Validate before calling
if (!$process->isRunning()) {
$process->enableOutput();
} Try / catch
try {
$process->enableOutput();
} catch (\RuntimeException $e) {
// process running; wait() or stop() before toggling output
} Prevention
- Toggle output only in pre-start configuration code.
- Centralize Process construction so all setters run before start() unconditionally.
When it happens
Trigger: Calling Process::enableOutput() after start()/run() on a still-running process.
Common situations: Trying to re-enable output after earlier disabling it, but doing so once the process is already running; generic configuration code that toggles output based on flags executed late in the lifecycle.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Disabling output while the process is running is not…
- Setting options while the process is running is not…
- Input cannot be set while the process is running.
- Start time is only available after process start.
- Output cannot be disabled while an idle timeout is set.
AI-assisted analysis of symfony/process@99b85026db (2026-09-14).
Data as JSON: /api/errors/c14644211015beb6.
Report an issue: GitHub.
Appendix: source
Thrown at Process.php:612
throw new LogicException('Output cannot be disabled while an idle timeout is set.');
}
$this->outputDisabled = true;
return $this;
}
/**
* Enables fetching output and error output from the underlying process.
*
* @return $this
*
* @throws RuntimeException In case the process is already running
*/
public function enableOutput(): static
{
if ($this->isRunning()) {
throw new RuntimeException('Enabling output while the process is running is not possible.');
}
$this->outputDisabled = false;
return $this;
}
/**
* Returns true in case the output is disabled, false otherwise.
*/
public function isOutputDisabled(): bool
{
return $this->outputDisabled;
}
/**
* Returns the current output of the process (STDOUT).
*View on GitHub (pinned to 99b85026db)