getredash/redash · error · ValueError

Invalid boolean value %r

Error message

Invalid boolean value %r

What it means

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.

Source

Thrown at redash/settings/helpers.py:30

    if "" in array:
        array.remove("")

    return array


def set_from_string(s):
    return set(array_from_string(s))


def parse_boolean(s):
    """Takes a string and returns the equivalent as a boolean value."""
    s = s.strip().lower()
    if s in ("yes", "true", "on", "1"):
        return True
    elif s in ("no", "false", "off", "0", "none"):
        return False
    else:
        raise ValueError("Invalid boolean value %r" % s)


def cast_int_or_default(val, default=None):
    try:
        return int(val)
    except (ValueError, TypeError):
        return default


def int_or_none(value):
    if value is None:
        return value

    return int(value)


def add_decode_responses_to_redis_url(url):
    """Make sure that the Redis URL includes the `decode_responses` option."""

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Change the env var to one of: true/false, yes/no, on/off, 1/0 (case-insensitive)
  2. Audit all boolean REDASH_* variables: `env | grep REDASH` and check each against the allowed set
  3. If you genuinely need custom tokens, pre-normalize them in the launch script before the process starts

Example fix

# before
REDASH_MULTI_ORG=enable
# after
REDASH_MULTI_ORG=true
Defensive patterns

Strategy: validation

Validate before calling

import os
BOOLS = {'yes','true','on','1','no','false','off','0','none'}
for k, v in os.environ.items():
    if k.startswith('REDASH_') and v.strip().lower() not in BOOLS | {'', } and '_ENABLED' in k:
        raise ValueError('bad boolean for {}: {!r}'.format(k, v))

Type guard

def is_parseable_boolean(s: str) -> bool:
    return s.strip().lower() in ('yes','true','on','1','no','false','off','0','none')

Try / catch

from redash.settings.helpers import parse_boolean
try:
    flag = parse_boolean(os.environ['REDASH_FEATURE_X'])
except ValueError as e:
    flag = False
    logger.warning('ignoring invalid boolean: %s', e)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid configuration value" and "Unsupported/Unknown setting value" errors: why libraries reject your config strings, numbers, and types — this error's family across 30 libraries.

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/a3a9f90971f4b1ac. Report an issue: GitHub.