n8n-io/n8n · error · ConfigurationError
Task timeout must be positive, got {task_timeout}
Error message
Task timeout must be positive, got {task_timeout} What it means
Thrown by TaskRunnerConfig.from_env when the task timeout read from N8N_RUNNERS_TASK_TIMEOUT is zero or negative. The task timeout is the maximum wall-clock seconds a Python code task may run before being killed; a non-positive value would mean immediate or never-ending timeout, neither of which is sensible.
Source
Thrown at packages/@n8n/task-runner-python/src/config/task_runner_config.py:82
builtins_deny: set[str]
env_deny: bool
allow_transitive_imports: bool
@property
def is_auto_shutdown_enabled(self) -> bool:
return self.auto_shutdown_timeout > 0
@classmethod
def from_env(cls):
grant_token = read_str_env(ENV_GRANT_TOKEN, "")
if not grant_token:
raise ConfigurationError(
"Environment variable N8N_RUNNERS_GRANT_TOKEN is required"
)
task_timeout = read_int_env(ENV_TASK_TIMEOUT, DEFAULT_TASK_TIMEOUT)
if task_timeout <= 0:
raise ConfigurationError(
f"Task timeout must be positive, got {task_timeout}"
)
auto_shutdown_timeout = read_int_env(
ENV_AUTO_SHUTDOWN_TIMEOUT, DEFAULT_AUTO_SHUTDOWN_TIMEOUT
)
if auto_shutdown_timeout < 0:
raise ConfigurationError(
f"Auto shutdown timeout must be non-negative, got {auto_shutdown_timeout}"
)
graceful_shutdown_timeout = read_int_env(
ENV_GRACEFUL_SHUTDOWN_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT
)
if graceful_shutdown_timeout <= 0:
raise ConfigurationError(
f"Graceful shutdown timeout must be positive, got {graceful_shutdown_timeout}"
)View on GitHub (pinned to 5ac6606e81)
Solutions
- Set N8N_RUNNERS_TASK_TIMEOUT to a positive integer (e.g. 60 for 60 seconds).
- If you want a very long timeout, use a large positive value (e.g. 3600) rather than 0 or negative.
- Check the environment variable for accidental negative signs or zero values.
- Restart the runner after correcting the value.
Example fix
# before export N8N_RUNNERS_TASK_TIMEOUT=0 # after export N8N_RUNNERS_TASK_TIMEOUT=60
Defensive patterns
Strategy: validation
Validate before calling
task_timeout = int(os.environ.get('N8N_RUNNERS_TASK_TIMEOUT', '60'))
if task_timeout <= 0:
raise ValueError(f'Task timeout must be positive, got {task_timeout}') Try / catch
from config.task_runner_config import ConfigurationError
try:
config = TaskRunnerConfig.from_env()
except ConfigurationError as e:
print(f'Fix configuration: {e}')
sys.exit(1) Prevention
- Always set task timeout to a sensible positive value (e.g. 60-300 seconds).
- Validate numeric config in deployment templates.
- Don't use 0 to mean 'no timeout' — use a large positive value instead.
When it happens
Trigger: The environment variable ENV_TASK_TIMEOUT is set to 0, a negative number, or left unset but the default DEFAULT_TASK_TIMEOUT was somehow overridden to a non-positive value. The check `if task_timeout <= 0` fires in from_env.
Common situations: Setting the timeout to 0 intending 'no timeout' (use a large number instead). Accidentally setting a negative value through a miscalculation in a deployment script. The default constant was changed incorrectly in a fork or custom build.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Auto shutdown timeout must be non-negative, got {auto_shutdo
- Graceful shutdown timeout must be positive, got {graceful_sh
- Environment variable N8N_RUNNERS_GRANT_TOKEN is required
- Max payload size of {max_payload_size} bytes exceeds pipe me
- Failed to read {env_name}_FILE from file {file_path}: {e}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/0e63c615b3ab5b75.
Report an issue: GitHub.