{"record":{"id":"e7e3ffb00b46801f","repo":"t8y2/dbx","slug":"name-must-contain-positive-integers-e7e3ff","errorCode":null,"errorMessage":"{name} must contain positive integers","messagePattern":"(.+?) must contain positive integers","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/bench/agent_compare.py","lineNumber":640,"sourceCode":"    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\ndef env_bool(name: str, fallback: bool) -> bool:\n    raw = os.getenv(name)\n    if raw is None or raw == \"\":\n        return fallback\n    normalized = raw.strip().lower()\n    if normalized in {\"1\", \"true\", \"yes\", \"on\"}:\n        return True\n    if normalized in {\"0\", \"false\", \"no\", \"off\"}:","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/bench/agent_compare.py#L622-L658","documentation":"env_int_list() parses a comma-separated list of integers from an environment variable and requires a non-empty list where every element is >= 1. It raises ValueError when the list is empty or any element is zero/negative.","triggerScenarios":"Env var parsed by env_int_list (called by main) is set to an empty string after raw was non-empty but splits to empty/whitespace, or contains a value like \"0\" or \"-2\", e.g. BENCH_SIZES=\"100,0\"; also fires if raw is \"\" and the fallback list itself is empty or contains non-positive ints.","commonSituations":"Trailing commas or whitespace-only entries producing bad splits; someone entering 0 to disable a workload size; malformed lists like \",,\".","solutions":["Set the variable to comma-separated positive integers, e.g. export BENCH_SIZES=100,1000,10000","Remove zero/negative entries from the list","Unset the variable to fall back to the built-in default list","Ensure no empty segments like \"100,,200\" in the value"],"exampleFix":"// before\nexport BENCH_SIZES=100,0,10000\n// after\nexport BENCH_SIZES=100,1000,10000","handlingStrategy":"validation","validationCode":"def valid_int_list_env(name: str, default: list[int]) -> list[int]:\n    raw = os.getenv(name, \"\")\n    if not raw:\n        return default\n    try:\n        values = [int(v.strip()) for v in raw.split(\",\") if v.strip()]\n    except ValueError:\n        raise SystemExit(f\"{name} must be comma-separated integers\")\n    if not values or any(v < 1 for v in values):\n        raise SystemExit(f\"{name} entries must be positive integers\")\n    return values","typeGuard":"def is_positive_int_list(values: list) -> bool:\n    return bool(values) and all(isinstance(v, int) and v >= 1 for v in values)","tryCatchPattern":"try:\n    sizes = env_int_list(\"BENCH_SIZES\", [100, 1000])\nexcept ValueError as e:\n    print(f\"invalid list: {e}; falling back to defaults\")\n    sizes = [100, 1000]","preventionTips":["Keep list values comma-separated with no trailing commas or empty segments","Sanity-check list contents with a one-liner before exporting: echo $BENCH_SIZES","Use defaults by unsetting the variable rather than hand-crafting edge-case lists","Add unit tests around env parsing helpers with malformed inputs"],"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-14T05:17:10.506Z"}