{"record":{"id":"c636a875969fab1b","repo":"reflex-dev/reflex","slug":"invalid-float-value-value-r-for-field-name","errorCode":null,"errorMessage":"Invalid float value: {value!r} for {field_name}","messagePattern":"Invalid float value: (.+?) for (.+?)","errorType":"exception","errorClass":"EnvironmentVarValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/environment.py","lineNumber":116,"sourceCode":"\ndef interpret_float_env(value: str, field_name: str) -> float:\n    \"\"\"Interpret a float 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 float(value)\n    except ValueError as ve:\n        msg = f\"Invalid float value: {value!r} for {field_name}\"\n        raise EnvironmentVarValueError(msg) from ve\n\n\ndef interpret_existing_path_env(value: str, field_name: str) -> ExistingPath:\n    \"\"\"Interpret a path environment variable value as an existing path.\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 path does not exist.\n    \"\"\"\n    path = Path(value)\n    if not path.exists():\n        msg = f\"Path does not exist: {path!r} for {field_name}\"","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/environment.py#L98-L134","documentation":"interpret_float_env converts an env var string with float(value); failure raises EnvironmentVarValueError naming the field. Same pattern as the int interpreter but for float-typed config fields.","triggerScenarios":"A float-typed field receives a non-numeric string: RATE=fast, COMPRESSION=0,5 (comma decimal separator), or an empty string.","commonSituations":"Locale differences (comma vs dot decimals), empty values from unset CI variables interpolating as '', or textual values in numeric fields.","solutions":["Use a dot-decimal numeric string, e.g. RATE=0.5","Ensure the variable is actually set (empty string is invalid)","For optional floats, use a union like float | None with a sentinel so unset maps properly"],"exampleFix":"# before\nRATE=0,5\n# after\nRATE=0.5\n","handlingStrategy":"validation","validationCode":"try:\n    float(raw)\nexcept ValueError:\n    raise SystemExit(f\"RATE must be a float, got {raw!r}\")","typeGuard":"def is_valid_float_env(v: str) -> bool:\n    try:\n        float(v)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":"except EnvironmentVarValueError:\n    value = 1.0  # fallback","preventionTips":["Use dot decimals regardless of locale","Guard against empty-string env values from unset CI variables"],"tags":["environment","float","validation","config"],"backgroundTag":"env-var-validation","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}