t8y2/dbx · error · ValueError

{name} must be positive

Error message

{name} must be positive

What it means

env_int() parses an environment variable as an int and rejects any value below 1. The benchmark uses it for counts like workers/concurrency, where 0 or negative numbers are meaningless. It raises ValueError with the variable name so the misconfigured key is identified immediately.

Source

Thrown at agents/drivers/hive-go/bench/agent_compare.py:632

def required_path(name: str) -> Path:
    value = os.getenv(name, "")
    if not value:
        raise ValueError(f"{name} is required")
    path = Path(value).expanduser().resolve()
    if not path.is_file():
        raise FileNotFoundError(path)
    return path


def env_default(name: str, fallback: str) -> str:
    return os.getenv(name, "") or fallback


def env_int(name: str, fallback: int) -> int:
    value = int(env_default(name, str(fallback)))
    if value < 1:
        raise ValueError(f"{name} must be positive")
    return value


def env_int_list(name: str, fallback: list[int]) -> list[int]:
    raw = os.getenv(name, "")
    values = fallback if not raw else [int(value.strip()) for value in raw.split(",")]
    if not values or any(value < 1 for value in values):
        raise ValueError(f"{name} must contain positive integers")
    return values


def env_float(name: str, fallback: float) -> float:
    value = float(env_default(name, str(fallback)))
    if value <= 0:
        raise ValueError(f"{name} must be positive")
    return value

View on GitHub (pinned to c0390bff16)

Solutions

  1. Set the variable to a positive integer (>= 1), e.g. export BENCH_CONCURRENCY=4
  2. If the variable is empty, unset it entirely so the fallback value is used
  3. Check all env vars consumed by connection_params/configured_workloads/query_workload/benchmark_concurrency/probe_candidate for zero or negative values

Example fix

// before
export BENCH_CONCURRENCY=0
// after
export BENCH_CONCURRENCY=4
Defensive patterns

Strategy: validation

Validate before calling

def valid_positive_int_env(name: str, default: int) -> int:
    raw = os.getenv(name)
    if raw is None or raw == "":
        return default
    try:
        value = int(raw)
    except ValueError:
        raise SystemExit(f"{name} must be an integer, got {raw!r}")
    if value < 1:
        raise SystemExit(f"{name} must be >= 1, got {value}")
    return value

Try / catch

try:
    workers = env_int("BENCH_CONCURRENCY", 4)
except ValueError as e:
    print(f"bad env config: {e}; using default")
    workers = 4

Prevention

When it happens

Trigger: An env var parsed by env_int (via connection_params, configured_workloads, query_workload, benchmark_concurrency, probe_candidate) is set to "0", a negative number, or a non-integer string that int() parses oddly; note int() itself will raise a different ValueError on non-numeric text.

Common situations: Setting BENCH_CONCURRENCY=0 to mean 'unlimited' (unsupported); shell exporting empty string with a fallback of 0; copy-pasting a float like 1.5 into an int var.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/9f99520480359b65. Report an issue: GitHub.