OpenRefine/OpenRefine · error · RuntimeException

Could not parse ' ' as a floating point number.

Error message

Could not parse '{val}' as a floating point number.

What it means

Configurations.getFloat reads a configuration value and parses it with Float.parseFloat; when the value is present but not a valid float it wraps the NumberFormatException in a RuntimeException with this message. Like getInteger, it exists to convert external string configuration into typed server settings with a clear failure mode.

Solutions

  1. Correct the property value to a plain Java-parseable float using '.' as the decimal separator, e.g. 0.5.
  2. Strip units, percent signs, spaces, and quotes from the value.
  3. Remove the property so the documented default is used instead.
  4. Validate all numeric refine.ini entries after edits before restarting the server.

Example fix

# before (refine.ini)
SOME_RATIO=0,5
# after
SOME_RATIO=0.5
Defensive patterns

Strategy: validation

Validate before calling

String val = System.getProperty(name);
if (val != null) { try { Float.parseFloat(val); } catch (NumberFormatException e) { throw new IllegalStateException(name + " must be a float, got: " + val); } }

Type guard

boolean isFloatString(String s) { try { Float.parseFloat(s); return true; } catch (NumberFormatException e) { return false; } }

Try / catch

try { float f = Configurations.getFloat(name, def); } catch (RuntimeException e) { if (e.getMessage().contains("floating point")) { f = def; } else { throw e; } }

Prevention

When it happens

Trigger: Setting a configuration property consumed via Configurations.getFloat(name, def) to a non-numeric string, e.g. TIMEOUT=slow or a value with a comma decimal separator like 0,5 (Java expects 0.5).

Common situations: Locale-style decimal commas in config files; unit suffixes ('1.5s', '90%'); typos or leftover placeholder text ('TODO', 'N/A') in numeric settings.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of OpenRefine/OpenRefine@a946177e04 (2026-09-08). Data as JSON: /api/errors/488510fa53318f8c. Report an issue: GitHub.

Appendix: source

Thrown at server/src/com/google/refine/Configurations.java:69

        final String val = get(name);
        return (val == null) ? def : Boolean.parseBoolean(val);
    }

    public static int getInteger(final String name, final int def) {
        final String val = get(name);
        try {
            return (val == null) ? def : Integer.parseInt(val);
        } catch (NumberFormatException e) {
            throw new RuntimeException("Could not parse '" + val + "' as an integer number.", e);
        }
    }

    public static float getFloat(final String name, final float def) {
        final String val = get(name);
        try {
            return (val == null) ? def : Float.parseFloat(val);
        } catch (NumberFormatException e) {
            throw new RuntimeException("Could not parse '" + val + "' as a floating point number.", e);
        }
    }

}

View on GitHub (pinned to a946177e04)