{"record":{"id":"9f99520480359b65","repo":"t8y2/dbx","slug":"name-must-be-positive-9f9952","errorCode":null,"errorMessage":"{name} must be positive","messagePattern":"(.+?) must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/bench/agent_compare.py","lineNumber":632,"sourceCode":"\ndef required_path(name: str) -> Path:\n    value = os.getenv(name, \"\")\n    if not value:\n        raise ValueError(f\"{name} is required\")\n    path = Path(value).expanduser().resolve()\n    if not path.is_file():\n        raise FileNotFoundError(path)\n    return path\n\n\ndef env_default(name: str, fallback: str) -> str:\n    return os.getenv(name, \"\") or fallback\n\n\ndef env_int(name: str, fallback: int) -> int:\n    value = int(env_default(name, str(fallback)))\n    if value < 1:\n        raise ValueError(f\"{name} must be positive\")\n    return value\n\n\ndef env_int_list(name: str, fallback: list[int]) -> list[int]:\n    raw = os.getenv(name, \"\")\n    values = fallback if not raw else [int(value.strip()) for value in raw.split(\",\")]\n    if not values or any(value < 1 for value in values):\n        raise ValueError(f\"{name} must contain positive integers\")\n    return values\n\n\ndef env_float(name: str, fallback: float) -> float:\n    value = float(env_default(name, str(fallback)))\n    if value <= 0:\n        raise ValueError(f\"{name} must be positive\")\n    return value\n\n","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/bench/agent_compare.py#L614-L650","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the variable to a positive integer (>= 1), e.g. export BENCH_CONCURRENCY=4","If the variable is empty, unset it entirely so the fallback value is used","Check all env vars consumed by connection_params/configured_workloads/query_workload/benchmark_concurrency/probe_candidate for zero or negative values"],"exampleFix":"// before\nexport BENCH_CONCURRENCY=0\n// after\nexport BENCH_CONCURRENCY=4","handlingStrategy":"validation","validationCode":"def valid_positive_int_env(name: str, default: int) -> int:\n    raw = os.getenv(name)\n    if raw is None or raw == \"\":\n        return default\n    try:\n        value = int(raw)\n    except ValueError:\n        raise SystemExit(f\"{name} must be an integer, got {raw!r}\")\n    if value < 1:\n        raise SystemExit(f\"{name} must be >= 1, got {value}\")\n    return value","typeGuard":null,"tryCatchPattern":"try:\n    workers = env_int(\"BENCH_CONCURRENCY\", 4)\nexcept ValueError as e:\n    print(f\"bad env config: {e}; using default\")\n    workers = 4","preventionTips":["Never set count-like env vars to 0 to mean 'unlimited'; omit them to use defaults","Validate all numeric env vars in one preflight function before the benchmark starts","Document accepted ranges next to each variable in your .env.example","Remember non-numeric strings raise int()'s own ValueError — quote-check values in shell"],"tags":["environment","configuration","validation","python"],"backgroundTag":"invalid-env-var-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}