{"record":{"id":"896cbc60627eb8db","repo":"reflex-dev/reflex","slug":"invalid-boolean-value-value-r-for-field-name","errorCode":null,"errorMessage":"Invalid boolean value: {value!r} for {field_name}","messagePattern":"Invalid boolean value: (.+?) for (.+?)","errorType":"exception","errorClass":"EnvironmentVarValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/environment.py","lineNumber":76,"sourceCode":"    Args:\n        value: The environment variable value.\n        field_name: The field name.\n\n    Returns:\n        The interpreted value.\n\n    Raises:\n        EnvironmentVarValueError: If the value is invalid.\n    \"\"\"\n    true_values = [\"true\", \"1\", \"yes\", \"y\"]\n    false_values = [\"false\", \"0\", \"no\", \"n\"]\n\n    if value.lower() in true_values:\n        return True\n    if value.lower() in false_values:\n        return False\n    msg = f\"Invalid boolean value: {value!r} for {field_name}\"\n    raise EnvironmentVarValueError(msg)\n\n\ndef interpret_int_env(value: str, field_name: str) -> int:\n    \"\"\"Interpret an integer environment variable value.\n\n    Args:\n        value: The environment variable value.\n        field_name: The field name.\n\n    Returns:\n        The interpreted value.\n\n    Raises:\n        EnvironmentVarValueError: If the value is invalid.\n    \"\"\"\n    try:\n        return int(value)\n    except ValueError as ve:","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/environment.py#L58-L94","documentation":"interpret_boolean_env only accepts a fixed set of truthy/falsy strings (case-insensitive); any other value raises EnvironmentVarValueError. This guards config fields typed bool from silently coercing arbitrary strings like Python's bool('false') == True would.","triggerScenarios":"Setting a bool-typed env var (e.g. TELEMETRY_ENABLED=false is fine, but TELEMETRY_ENABLED=0/1/off variants outside the accepted lists, or a stray value like 'fals') and starting the app; interpret_env_var_value dispatches to this function for bool fields.","commonSituations":"Using 2/1 style flags, values with whitespace or quotes from CI secrets, or 'yes'/'no' when not in the accepted sets.","solutions":["Use one of the accepted boolean words (typically 'true'/'false', case-insensitive)","Strip quotes/whitespace from the env value (common with CI/CD secret interpolation)","Check the accepted true/false lists in reflex_base.environment and align your value"],"exampleFix":"# before\nTELEMETRY_ENABLED=fals  # typo\n# after\nTELEMETRY_ENABLED=false\n","handlingStrategy":"validation","validationCode":"import re\nTRUE = {\"true\", \"1\", \"yes\", \"on\"}\nFALSE = {\"false\", \"0\", \"no\", \"off\"}\nv = os.environ.get(\"FLAG\", \"\").strip().lower()\nassert v in TRUE | FALSE, f\"FLAG must be one of {sorted(TRUE | FALSE)}\"","typeGuard":"def is_valid_bool_env(v: str) -> bool:\n    return v.strip().lower() in {\"true\", \"false\", \"1\", \"0\", \"yes\", \"no\", \"on\", \"off\"}","tryCatchPattern":"from reflex_base.environment import EnvironmentVarValueError\ntry:\n    interpret_boolean_env(raw, \"FLAG\")\nexcept EnvironmentVarValueError as e:\n    raw = \"false\"  # safe default","preventionTips":["Standardize on lowercase true/false everywhere","Strip whitespace/quotes when injecting secrets via CI"],"tags":["environment","boolean","validation","config"],"backgroundTag":"env-var-validation","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}