{"record":{"id":"56ace50a860b7ecf","repo":"t8y2/dbx","slug":"name-must-be-a-boolean-56ace5","errorCode":null,"errorMessage":"{name} must be a boolean","messagePattern":"(.+?) must be a boolean","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/bench/agent_compare.py","lineNumber":660,"sourceCode":"\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\"}:\n        return False\n    raise ValueError(f\"{name} must be a boolean\")\n\n\nif __name__ == \"__main__\":\n    main()\n","sourceCodeStart":642,"sourceCodeEnd":665,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/bench/agent_compare.py#L642-L665","documentation":"env_bool() parses an environment variable as a boolean, accepting 1/true/yes/on and 0/false/no/off case-insensitively. If the value is any other non-empty string it raises ValueError with the variable name. Empty/unset values fall back to the default instead.","triggerScenarios":"connection_params reads a boolean env var whose value is a typo or unexpected word, e.g. BENCH_TLS=\"enabled\" or \"TURE\" — anything not in the two accepted sets after strip().lower().","commonSituations":"Using \"y\"/\"n\", \"enable\"/\"disable\", or \"True \" with odd casing is fine but \"on/off\" misspellings are not; values copied from other tools with different boolean conventions (e.g. \"1 \" fine, \"yes!\" not).","solutions":["Set the variable to one of: 1, true, yes, on, 0, false, no, off (any case)","Unset or empty the variable to use the fallback","Fix the typo in the value (e.g. TURE -> true)","Wrap the read in try/except ValueError if a non-boolean value should degrade to the default"],"exampleFix":"// before\nexport BENCH_TLS=enabled\n// after\nexport BENCH_TLS=true","handlingStrategy":"validation","validationCode":"TRUE_VALUES = {\"1\", \"true\", \"yes\", \"on\"}\nFALSE_VALUES = {\"0\", \"false\", \"no\", \"off\"}\n\ndef valid_bool_env(name: str, default: bool) -> bool:\n    raw = os.getenv(name)\n    if raw is None or raw == \"\":\n        return default\n    normalized = raw.strip().lower()\n    if normalized in TRUE_VALUES:\n        return True\n    if normalized in FALSE_VALUES:\n        return False\n    raise SystemExit(f\"{name} must be one of {sorted(TRUE_VALUES | FALSE_VALUES)}\")","typeGuard":null,"tryCatchPattern":"try:\n    use_tls = env_bool(\"BENCH_TLS\", False)\nexcept ValueError as e:\n    print(f\"bad boolean: {e}; defaulting to False\")\n    use_tls = False","preventionTips":["Stick to the accepted literals: 1/true/yes/on or 0/false/no/off","Check spelling and casing conventions when copying env from other tools (e.g. \"enabled\" is not accepted)","List accepted boolean literals in your .env.example","Normalize at the boundary: lower()/strip() your own values before export if generated by script"],"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"}