{"record":{"id":"a3a9f90971f4b1ac","repo":"getredash/redash","slug":"invalid-boolean-value-r","errorCode":null,"errorMessage":"Invalid boolean value %r","messagePattern":"Invalid boolean value %r","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"redash/settings/helpers.py","lineNumber":30,"sourceCode":"    if \"\" in array:\n        array.remove(\"\")\n\n    return array\n\n\ndef set_from_string(s):\n    return set(array_from_string(s))\n\n\ndef parse_boolean(s):\n    \"\"\"Takes a string and returns the equivalent as a boolean value.\"\"\"\n    s = s.strip().lower()\n    if s in (\"yes\", \"true\", \"on\", \"1\"):\n        return True\n    elif s in (\"no\", \"false\", \"off\", \"0\", \"none\"):\n        return False\n    else:\n        raise ValueError(\"Invalid boolean value %r\" % s)\n\n\ndef cast_int_or_default(val, default=None):\n    try:\n        return int(val)\n    except (ValueError, TypeError):\n        return default\n\n\ndef int_or_none(value):\n    if value is None:\n        return value\n\n    return int(value)\n\n\ndef add_decode_responses_to_redis_url(url):\n    \"\"\"Make sure that the Redis URL includes the `decode_responses` option.\"\"\"","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/settings/helpers.py#L12-L48","documentation":"Raised by parse_boolean (redash/settings/helpers.py:30) as ValueError when a settings string is not one of the recognized truthy/falsy words (yes/true/on/1 vs no/false/off/0/none) after stripping and lowercasing. Redash parses many REDASH_*_ENABLED-style env vars through this helper, so any other token — including 'enabled', 'y', '2', or empty-with-whitespace variants not in the list — aborts settings import.","triggerScenarios":"Setting an env var like REDASH_MULTI_ORG or any boolean REDASH_* flag to a non-recognized value, e.g. REDASH_ENABLED=yes please, enabled, y, TRUE-ish, 2, or containing stray characters, then starting Redash.","commonSituations":"Copy-pasting example .env values that use different conventions ('y', 'Yes ' handled, but 'enable' not); quoting artifacts; locale-style values like 'verdad'; numeric values other than 0/1.","solutions":["Change the env var to one of: true/false, yes/no, on/off, 1/0 (case-insensitive)","Audit all boolean REDASH_* variables: `env | grep REDASH` and check each against the allowed set","If you genuinely need custom tokens, pre-normalize them in the launch script before the process starts"],"exampleFix":"# before\nREDASH_MULTI_ORG=enable\n# after\nREDASH_MULTI_ORG=true","handlingStrategy":"validation","validationCode":"import os\nBOOLS = {'yes','true','on','1','no','false','off','0','none'}\nfor k, v in os.environ.items():\n    if k.startswith('REDASH_') and v.strip().lower() not in BOOLS | {'', } and '_ENABLED' in k:\n        raise ValueError('bad boolean for {}: {!r}'.format(k, v))","typeGuard":"def is_parseable_boolean(s: str) -> bool:\n    return s.strip().lower() in ('yes','true','on','1','no','false','off','0','none')","tryCatchPattern":"from redash.settings.helpers import parse_boolean\ntry:\n    flag = parse_boolean(os.environ['REDASH_FEATURE_X'])\nexcept ValueError as e:\n    flag = False\n    logger.warning('ignoring invalid boolean: %s', e)","preventionTips":["Use only true/false (or 1/0) in .env files for REDASH_* flags","Lint .env files in CI against the allowed boolean set","Centralize env parsing so invalid values fail fast with clear context"],"tags":["redash","configuration","environment-variable","validation"],"backgroundTag":"invalid-configuration-value","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}