{"record":{"id":"1dd5e8bb4b814aa0","repo":"apache/druid","slug":"property-s-is-expected-to-be-an-int-it-is-not","errorCode":null,"errorMessage":"Property[%s] is expected to be an int, it is not[%s].","messagePattern":"Property\\[(.+?)\\] is expected to be an int, it is not\\[(.+?)\\]\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/common/utils/PropUtils.java","lineNumber":62,"sourceCode":"  }\n\n  public static int getPropertyAsInt(Properties props, String property, Integer defaultValue)\n  {\n    String retVal = props.getProperty(property);\n\n    if (retVal == null) {\n      if (defaultValue == null) {\n        throw new ISE(\"Property[%s] not specified.\", property);\n      } else {\n        return defaultValue;\n      }\n    }\n\n    try {\n      return Integer.parseInt(retVal);\n    }\n    catch (NumberFormatException e) {\n      throw new ISE(e, \"Property[%s] is expected to be an int, it is not[%s].\", property, retVal);\n    }\n  }\n}\n","sourceCodeStart":44,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/common/utils/PropUtils.java#L44-L66","documentation":"PropUtils.getPropertyAsInt parses the property string with Integer.parseInt. When the value exists but is not a valid 32-bit integer, Druid wraps the NumberFormatException in an IllegalStateException identifying the property and offending value. It signals an invalid config value rather than a missing one.","triggerScenarios":"Calling PropUtils.getPropertyAsInt(props, \"druid.port\", null) where the property value is a non-numeric string such as \"abc\", \"8080x\", \"\", or a number exceeding Integer range (e.g. \"99999999999\").","commonSituations":"Typos or stray whitespace/quotes in -D flags in jvm.config; environment-variable substitution in startup scripts leaving a literal like \"${PORT}\" or empty string; copying a port or count value that overflows int.","solutions":["Correct the property value to a plain integer (no quotes, whitespace, or units) in jvm.config or the properties source.","Print the value first (System.getProperty(\"druid.port\")) to see exactly what the JVM received.","Check startup scripts for unexpanded shell variables or concatenated characters in the -D argument.","Use Integer.MAX_VALUE-bounded values; use a long-typed property API if the value exceeds int range."],"exampleFix":"// before (jvm.config)\n-Ddruid.port=${DRUID_PORT\n// after (jvm.config)\n-Ddruid.port=8082","handlingStrategy":"validation","validationCode":"String raw = System.getProperty(\"druid.port\");\nif (raw == null || !raw.matches(\"\\\\d+\")) {\n  throw new IllegalStateException(\"druid.port must be an integer, got: \" + raw);\n}","typeGuard":null,"tryCatchPattern":"try {\n  int v = PropUtils.getPropertyAsInt(props, key, null);\n} catch (ISE e) {\n  log.error(\"Bad integer property [%s], falling back\", key, e);\n  v = DEFAULT;\n}","preventionTips":["Quote/escape -D values in shell startup scripts and verify variable expansion","Log effective property values at startup for debugging","Keep integer config values within int range"],"tags":["configuration","number-format","properties"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}