n8n-io/n8n · error · ValueError

Environment variable {env_name} must be a float, got '{value

Error message

Environment variable {env_name} must be a float, got '{value}'

What it means

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.

Source

Thrown at packages/@n8n/task-runner-python/src/env.py:55

            f"Environment variable {env_name} must be an integer, got '{value}'"
        )


def read_bool_env(env_name: str, default: bool) -> bool:
    value = read_env(env_name)
    if value is None:
        return default
    return value.strip().lower() == "true"


def read_float_env(env_name: str, default: float) -> float:
    value = read_env(env_name)
    if value is None:
        return default
    try:
        return float(value)
    except ValueError:
        raise ValueError(
            f"Environment variable {env_name} must be a float, got '{value}'"
        )

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Set the environment variable to a valid float string (e.g. '1.5', '0.0', '100').
  2. Remove any non-numeric characters or unit suffixes.
  3. Check for locale-specific decimal separators (use '.' not ',').
  4. Validate the value in your deployment template before applying.

Example fix

# before
export SOME_FLOAT_CONFIG='1,5'  # comma decimal separator
# after
export SOME_FLOAT_CONFIG='1.5'
Defensive patterns

Strategy: validation

Validate before calling

def validate_float_env(name: str, default: float) -> float:
    raw = os.environ.get(name)
    if raw is None:
        return default
    try:
        return float(raw)
    except ValueError:
        raise ValueError(f'{name} must be a float, got {raw!r}')

validate_float_env('SOME_FLOAT_CONFIG', 1.0)

Try / catch

from env import read_float_env

try:
    value = read_float_env('SOME_FLOAT_CONFIG', 1.0)
except ValueError as e:
    print(f'Environment error: {e}')
    sys.exit(1)

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/44991289b1f5b0be. Report an issue: GitHub.