datawhalechina/hello-agents · error · ConfigurationError
LLM_TIMEOUT 必须大于 0
Error message
LLM_TIMEOUT 必须大于 0
What it means
Raised by LLMSettings validation when LLM_TIMEOUT is <= 0. A non-positive timeout would make every request fail immediately or behave undefined, so it is rejected up front. Note the type check happens earlier: a non-integer string raises '必须是整数' first; this error means the value parsed fine but is 0 or negative.
Source
Thrown at Co-creation-projects/zenith191-RequirementClarifierAgent/src/config.py:80
for name, value in (
("LLM_MODEL_ID", self.model),
("LLM_API_KEY", self.api_key),
("LLM_BASE_URL", self.base_url),
)
if not value
]
if missing:
raise ConfigurationError(
"缺少 LLM 配置:" + ", ".join(missing) + "。请先复制并填写 .env。"
)
lowered_key = self.api_key.casefold()
if lowered_key.startswith("your_") or lowered_key in {"changeme", "replace_me"}:
raise ConfigurationError("LLM_API_KEY 仍是占位符,请在 .env 中填写真实密钥")
if not 0 <= self.temperature <= 2:
raise ConfigurationError("LLM_TEMPERATURE 必须位于 0 到 2 之间")
if self.timeout <= 0:
raise ConfigurationError("LLM_TIMEOUT 必须大于 0")
View on GitHub (pinned to 606a07d341)
Solutions
- Set a positive integer of seconds, e.g. LLM_TIMEOUT=120 (the default).
- For long LLM calls, raise it (e.g. 300) rather than zeroing it — this config has no 'infinite' mode.
- Remove the variable to accept the default 120.
Example fix
# .env before LLM_TIMEOUT=0 # .env after LLM_TIMEOUT=120
Defensive patterns
Strategy: validation
Validate before calling
import os
timeout = int(os.getenv("LLM_TIMEOUT", "120"))
if timeout <= 0:
raise SystemExit("LLM_TIMEOUT must be a positive integer of seconds") Try / catch
try:
settings = LLMSettings.from_env()
except ConfigurationError as e:
if "TIMEOUT" in str(e):
os.environ.pop("LLM_TIMEOUT", None) # fall back to default 120
settings = LLMSettings.from_env()
else:
raise Prevention
- Remember this config has no 'infinite timeout' — always a positive seconds value.
- Size timeouts above your slowest expected LLM call (long prompts can take 60s+).
- Unit-test the config loader with boundary values 0, 1, and a large value.
When it happens
Trigger: Setting LLM_TIMEOUT=0 (sometimes done to mean 'no timeout'), LLM_TIMEOUT=-1 copied from a socket-timeout convention, or passing timeout=0 programmatically.
Common situations: Developer intends 'disable timeout' and uses 0 or -1 as in other libraries; CI env carries a negative test value; misreading units (0 seconds vs 0 minutes).
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Unsupported latency_mode: {latency_mode}
- Unsupported vision_review_mode: {vision_review_mode}
- Unsupported quality_mode: {quality_mode}
- Unsupported document_ingestion_mode: {mode}
- Unsupported reviewer mode: {review_mode}
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/51fbe256f2c481b3.
Report an issue: GitHub.