{"record":{"id":"33102ecc2fd788d7","repo":"bazelbuild/bazel","slug":"input-is-not-a-double","errorCode":null,"errorMessage":"'\" + input + \"' is not a double","messagePattern":"'\" \\+ input \\+ \"' is not a double","errorType":"validation","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/Converters.java","lineNumber":143,"sourceCode":"      } catch (NumberFormatException e) {\n        throw new OptionsParsingException(\"'\" + input + \"' is not a long\", e);\n      }\n    }\n\n    @Override\n    public String getTypeDescription() {\n      return \"a long integer\";\n    }\n  }\n\n  /** Standard converter for doubles. */\n  public static class DoubleConverter extends Converter.Contextless<Double> {\n    @Override\n    public Double convert(String input) throws OptionsParsingException {\n      try {\n        return Double.parseDouble(input);\n      } catch (NumberFormatException e) {\n        throw new OptionsParsingException(\"'\" + input + \"' is not a double\", e);\n      }\n    }\n\n    @Override\n    public String getTypeDescription() {\n      return \"a double\";\n    }\n  }\n\n  /** Standard converter for TriState values. */\n  public static class TriStateConverter extends EnumConverter<TriState> {\n    public TriStateConverter() {\n      super(TriState.class, \"tri-state (auto, yes, no) option value\");\n    }\n\n    @Override\n    public TriState convert(@Nullable String input) throws OptionsParsingException {\n      if (input == null) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/Converters.java#L125-L161","documentation":"Thrown by Converters.DoubleConverter.convert when Double.parseDouble(input) raises NumberFormatException. parseDouble accepts standard floating point including scientific notation and the literals NaN/Infinity, so this error means the string is not a Java-parseable double at all (empty, comma decimal separator, trailing characters).","triggerScenarios":"Passing --my_ratio=1,5 (comma), --my_ratio=\"1.5 \", --my_ratio=\", --my_ratio=50% or other non-numeric text to a DoubleConverter-backed option.","commonSituations":"Locale-formatted numbers pasted from European spreadsheets; percent signs or units left on the value; a typo like 1.5.5; shell quoting that splits the value.","solutions":["Pass a plain decimal or scientific literal: --my_ratio=0.5 or --my_ratio=5e-1.","Strip units/percent before passing the value; convert locale separators to '.'.","Ensure the shell variable is quoted so the value arrives intact as one token."],"exampleFix":"# before\nbazel build --my_ratio=1,5 //...\n# after\nbazel build --my_ratio=1.5 //...","handlingStrategy":"validation","validationCode":"boolean isParsableDouble(String s) {\n  if (s == null || s.isEmpty()) return false;\n  try { Double.parseDouble(s); return true; }\n  catch (NumberFormatException e) { return false; }\n}","typeGuard":"boolean isDoubleFlagValue(String s) {\n  return s != null && s.matches(\"[+-]?(\") /* use isParsableDouble instead; regex is brittle */;\n} // prefer validation over regex for doubles","tryCatchPattern":null,"preventionTips":["Normalize locale decimal separators to '.' before passing values.","Remove % and unit suffixes from numeric option values.","Quote shell variables so whitespace never leaks into flag values."],"tags":["bazel","options","converter","double","cli"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}