HKUDS/Vibe-Trading · error · ValueError

SWARM_WORKER_RETRY_MAX_DELAY_S must be greater than or equal

Error message

SWARM_WORKER_RETRY_MAX_DELAY_S must be greater than or equal to SWARM_WORKER_RETRY_BASE_DELAY_S

What it means

Raised by the SwarmConfig model_validator when SWARM_WORKER_RETRY_MAX_DELAY_S is strictly less than SWARM_WORKER_RETRY_BASE_DELAY_S. Since exponential backoff starts at the base delay and caps at the max, a max below base is nonsensical, so config parsing fails at validation time.

Source

Thrown at agent/src/config/env_schema.py:359

    swarm_worker_timeout: int = Field(alias="SWARM_WORKER_TIMEOUT", default=300)
    swarm_worker_max_iter: int = Field(alias="SWARM_WORKER_MAX_ITER", default=50)
    swarm_max_workers: int = Field(alias="SWARM_MAX_WORKERS", default=4)
    swarm_timeout: int = Field(alias="SWARM_TIMEOUT", default=1800)
    swarm_heartbeat_interval_s: float = Field(alias="SWARM_HEARTBEAT_INTERVAL_S", default=3.0)
    swarm_stream_retry_delay_s: float = Field(alias="SWARM_STREAM_RETRY_DELAY_S", default=1.0)
    swarm_worker_retry_base_delay_s: float = Field(
        alias="SWARM_WORKER_RETRY_BASE_DELAY_S", default=1.0, ge=0
    )
    swarm_worker_retry_max_delay_s: float = Field(
        alias="SWARM_WORKER_RETRY_MAX_DELAY_S", default=30.0, ge=0
    )
    swarm_grounding_max_symbols: int = Field(alias="SWARM_GROUNDING_MAX_SYMBOLS", default=8)

    @model_validator(mode="after")
    def _validate_worker_retry_delays(self) -> SwarmConfig:
        if self.swarm_worker_retry_max_delay_s < self.swarm_worker_retry_base_delay_s:
            raise ValueError(
                "SWARM_WORKER_RETRY_MAX_DELAY_S must be greater than or equal to "
                "SWARM_WORKER_RETRY_BASE_DELAY_S"
            )
        return self


# ---------------------------------------------------------------------------
# Agent Tuning
# ---------------------------------------------------------------------------


class AgentTuningConfig(_EnvBase):
    """Agent loop tuning, content-filter, scheduler, and feature flags.

    Sources: ``src/agent/loop.py``, ``src/providers/content_filter.py``,
    ``src/scheduled_research/executor.py``, ``src/live/order_guard.py``,
    ``src/factors/_backend.py``, ``src/factors/bench_runner.py``,
    ``src/tools/web_search_tool.py``, ``api_server.py``.

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Set SWARM_WORKER_RETRY_MAX_DELAY_S >= SWARM_WORKER_RETRY_BASE_DELAY_S (e.g. base=1, max=30).
  2. If you intended fast retries, lower SWARM_WORKER_RETRY_BASE_DELAY_S instead.
  3. Search .env / compose files for both variables and align them.

Example fix

# before
SWARM_WORKER_RETRY_BASE_DELAY_S=10
SWARM_WORKER_RETRY_MAX_DELAY_S=5

# after
SWARM_WORKER_RETRY_BASE_DELAY_S=1
SWARM_WORKER_RETRY_MAX_DELAY_S=30
Defensive patterns

Strategy: validation

Validate before calling

def retry_delays_valid(base: float, mx: float) -> bool:
    return base > 0 and mx >= base

Prevention

When it happens

Trigger: Setting SWARM_WORKER_RETRY_MAX_DELAY_S to a smaller value than SWARM_WORKER_RETRY_BASE_DELAY_S via environment or config file, then constructing SwarmConfig.

Common situations: Copy-paste env files where units are confused (seconds vs ms); lowering max delay to speed up tests without adjusting base; typos in one of the two variables.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/f5727a52c49023a5. Report an issue: GitHub.