symfony/process · error · LogicException
Idle timeout cannot be set while the output is disabled.
Error message
Idle timeout cannot be set while the output is disabled.
What it means
setIdleTimeout() throws this LogicException when a non-null timeout is requested while process output is disabled. Idle-timeout detection works by monitoring output reads; with output disabled there is nothing to observe, so the feature cannot function and the combination is rejected.
Solutions
- Re-enable output (enableOutput()) before setting the idle timeout.
- Use setTimeout() (total runtime cap) instead of an idle timeout.
- Order the calls: setIdleTimeout() first, then disableOutput() is itself rejected too — so drop one of the two options.
Example fix
// before $process->disableOutput(); $process->setIdleTimeout(5.0); // LogicException // after $process->setIdleTimeout(5.0); // keep output enabled $process->start();
Defensive patterns
Strategy: validation
Validate before calling
if (null !== $timeout && $idleTimeoutDesired) {
// keep output enabled; skip disableOutput() and call setIdleTimeout() before start()
} Try / catch
try {
$process->setIdleTimeout($timeout);
} catch (\LogicException $e) {
$process->setTimeout($timeout); // fall back to total-time cap
} Prevention
- Enforce in config validation: idleTimeout implies output enabled.
- Order setters: setIdleTimeout() first in the builder and assert output stays enabled.
When it happens
Trigger: Calling setIdleTimeout(float) after disableOutput() was called (outputDisabled === true). Passing null is allowed.
Common situations: Silencing output for a noisy subprocess then later adding a hang-protection idle timeout; configuration assembled from separate flags that independently enable disableOutput and setIdleTimeout.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Output cannot be disabled while an idle timeout is set.
- 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/3b43616f2d423a95.
Report an issue: GitHub.
Appendix: source
Thrown at Process.php:1065
$this->timeout = $this->validateTimeout($timeout);
return $this;
}
/**
* Sets the process idle timeout (max. time since last output) in seconds.
*
* To disable the timeout, set this value to null.
*
* @return $this
*
* @throws LogicException if the output is disabled
* @throws InvalidArgumentException if the timeout is negative
*/
public function setIdleTimeout(?float $timeout): static
{
if (null !== $timeout && $this->outputDisabled) {
throw new LogicException('Idle timeout cannot be set while the output is disabled.');
}
$this->idleTimeout = $this->validateTimeout($timeout);
return $this;
}
/**
* Enables or disables the TTY mode.
*
* @return $this
*
* @throws RuntimeException In case the TTY mode is not supported
*/
public function setTty(bool $tty): static
{
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');View on GitHub (pinned to 99b85026db)