symfony/process · error · LogicException
Output cannot be disabled while an idle timeout is set.
Error message
Output cannot be disabled while an idle timeout is set.
What it means
disableOutput() throws this LogicException when an idle timeout has been configured. The idle timeout mechanism relies on reading process output to detect inactivity; with output disabled there is no read stream to monitor, so the two options are mutually exclusive and the library rejects the combination.
Solutions
- Remove the setIdleTimeout() call if output must be disabled.
- Keep the idle timeout and leave output enabled (do not call disableOutput()).
- Use setTimeout() as a total-duration cap instead, which does not conflict with disabled output.
Example fix
// before $process->setIdleTimeout(5.0); $process->disableOutput(); // LogicException // after $process->setTimeout(30.0); $process->disableOutput();
Defensive patterns
Strategy: validation
Validate before calling
if (null !== $timeout && $process instanceof \Symfony\Component\Process\Process) {
// idle timeout requires output enabled: do not call disableOutput()
} Try / catch
try {
$process->disableOutput();
} catch (\LogicException $e) {
// idle timeout is set; use setTimeout() instead or keep output enabled
} Prevention
- Treat idle timeout and disabled output as mutually exclusive in your config schema.
- Prefer setTimeout() (wall-clock cap) when output is disabled.
When it happens
Trigger: Calling setIdleTimeout(...) followed by disableOutput(), or calling disableOutput() after setIdleTimeout() was set on the same Process instance.
Common situations: Developers hardening long-running subprocesses against hangs (adding an idle timeout) who also try to silence output for performance; configuration code setting both options independently.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Idle timeout cannot be set while the output is disabled.
- Input cannot be set while the process is running.
- Start time is only available after process start.
- Disabling output while the process is running is not…
- Enabling output while the process is running is not…
AI-assisted analysis of symfony/process@99b85026db (2026-09-14).
Data as JSON: /api/errors/26e1cb419afdd640.
Report an issue: GitHub.
Appendix: source
Thrown at Process.php:594
return $this;
}
/**
* Disables fetching output and error output from the underlying process.
*
* @return $this
*
* @throws RuntimeException In case the process is already running
* @throws LogicException if an idle timeout is set
*/
public function disableOutput(): static
{
if ($this->isRunning()) {
throw new RuntimeException('Disabling output while the process is running is not possible.');
}
if (null !== $this->idleTimeout) {
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.');View on GitHub (pinned to 99b85026db)