{"record":{"id":"44991289b1f5b0be","repo":"n8n-io/n8n","slug":"environment-variable-env-name-must-be-a-float-g","errorCode":null,"errorMessage":"Environment variable {env_name} must be a float, got '{value}'","messagePattern":"Environment variable (.+?) must be a float, got '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/task-runner-python/src/env.py","lineNumber":55,"sourceCode":"            f\"Environment variable {env_name} must be an integer, got '{value}'\"\n        )\n\n\ndef read_bool_env(env_name: str, default: bool) -> bool:\n    value = read_env(env_name)\n    if value is None:\n        return default\n    return value.strip().lower() == \"true\"\n\n\ndef read_float_env(env_name: str, default: float) -> float:\n    value = read_env(env_name)\n    if value is None:\n        return default\n    try:\n        return float(value)\n    except ValueError:\n        raise ValueError(\n            f\"Environment variable {env_name} must be a float, got '{value}'\"\n        )\n","sourceCodeStart":37,"sourceCodeEnd":58,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/task-runner-python/src/env.py#L37-L58","documentation":"Thrown by read_float_env in the Python task runner when an environment variable expected to be a float cannot be parsed as one. The function reads the raw string value and attempts float(value); on ValueError it re-ra raises with a descriptive message including the variable name and the offending value. Used for any floating-point config field.","triggerScenarios":"Any environment variable read via read_float_env is set to a string that float() cannot parse, such as 'abc', 'true', '', or a string with invalid characters. float(value) raises ValueError, caught and re-raised.","commonSituations":"Typo in a float environment variable value. Setting a non-numeric string where a float is expected. Accidentally including unit suffixes or currency symbols. A default that was supposed to be a number but was stored as a descriptive string.","solutions":["Set the environment variable to a valid float string (e.g. '1.5', '0.0', '100').","Remove any non-numeric characters or unit suffixes.","Check for locale-specific decimal separators (use '.' not ',').","Validate the value in your deployment template before applying."],"exampleFix":"# before\nexport SOME_FLOAT_CONFIG='1,5'  # comma decimal separator\n# after\nexport SOME_FLOAT_CONFIG='1.5'","handlingStrategy":"validation","validationCode":"def validate_float_env(name: str, default: float) -> float:\n    raw = os.environ.get(name)\n    if raw is None:\n        return default\n    try:\n        return float(raw)\n    except ValueError:\n        raise ValueError(f'{name} must be a float, got {raw!r}')\n\nvalidate_float_env('SOME_FLOAT_CONFIG', 1.0)","typeGuard":null,"tryCatchPattern":"from env import read_float_env\n\ntry:\n    value = read_float_env('SOME_FLOAT_CONFIG', 1.0)\nexcept ValueError as e:\n    print(f'Environment error: {e}')\n    sys.exit(1)","preventionTips":["Use period ('.') as the decimal separator, not comma.","Avoid unit suffixes and currency symbols in float environment variables.","Validate numeric environment variables in deployment templates."],"tags":["task-runner","python","configuration","env-var","type-error","startup"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}