nathanmarz/storm · error · IllegalArgumentException
Don't know how to convert
Error message
Don't know how to convert ${o} + to int What it means
Utils.getInt converts a config value object (typically from a Conf map) into an int. It only supports Long, Integer, and Short; any other type (e.g. String, Double) causes an IllegalArgumentException. It exists because Thrift/JSON config values deserializing from YAML often arrive as Long.
Solutions
- Quote-free the value in the config: remove surrounding quotes so it parses as a number, then restart.
- Convert before calling: Utils.getInt(Long.valueOf(o.toString())) or Integer.parseInt(o.toString()) if the value is a numeric String.
- Pass an Integer/Long/Short object (cast or re-set the config value with the correct type).
- For null, ensure the config key is actually set before reading.
Example fix
// before
int maxPending = Utils.getInt(conf.get("topology.max.spout.pending")); // value is String "20"
// after
Object v = conf.get("topology.max.spout.pending");
int maxPending = (v instanceof Number) ? Utils.getInt(v) : Integer.parseInt(String.valueOf(v)); Defensive patterns
Strategy: type-guard
Validate before calling
Object v = conf.get(key);
if (!(v instanceof Long || v instanceof Integer || v instanceof Short)) {
throw new IllegalArgumentException(key + " must be numeric, got: " + (v == null ? "null" : v.getClass().getName()));
} Type guard
boolean isIntLike(Object o) {
return o instanceof Long || o instanceof Integer || o instanceof Short;
} Try / catch
try {
int value = Utils.getInt(o);
} catch (IllegalArgumentException e) {
int value = Integer.parseInt(String.valueOf(o)); // handle numeric strings
} Prevention
- Never quote numeric values in YAML/JSON configs
- Normalize config maps to typed getters before passing to Storm APIs
- Check value class at config-load time and fail fast with a clear message
When it happens
Trigger: Calling Utils.getInt(o) with a String (e.g. "10" loaded from an untyped config file), a Double, or a null; passing a config key whose value was set programmatically as a non-integral type into an API that calls getInt internally.
Common situations: YAML/JSON config files where a numeric setting was quoted ("topology.max.spout.pending: "20""), making it a String at runtime; configs set via a generic Map<String,Object> API with wrong value types.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Could not instantiate a class listed in config under section
- Unable to create serializer
- Cannot set serializations for a component using fluent API
- Could not find component with id
- Version already exists or data already exists
AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12).
Data as JSON: /api/errors/c490dd5ef5ff260d.
Report an issue: GitHub.
Appendix: source
Thrown at storm-core/src/jvm/backtype/storm/utils/Utils.java:296
}
if(topology.get_bolts().containsKey(id)) {
return topology.get_bolts().get(id).get_common();
}
if(topology.get_state_spouts().containsKey(id)) {
return topology.get_state_spouts().get(id).get_common();
}
throw new IllegalArgumentException("Could not find component with id " + id);
}
public static Integer getInt(Object o) {
if(o instanceof Long) {
return ((Long) o ).intValue();
} else if (o instanceof Integer) {
return (Integer) o;
} else if (o instanceof Short) {
return ((Short) o).intValue();
} else {
throw new IllegalArgumentException("Don't know how to convert " + o + " + to int");
}
}
public static long secureRandomLong() {
return UUID.randomUUID().getLeastSignificantBits();
}
public static CuratorFramework newCurator(Map conf, List<String> servers, Object port, String root) {
return newCurator(conf, servers, port, root, null);
}
public static class BoundedExponentialBackoffRetry extends ExponentialBackoffRetry {
protected final int maxRetryInterval;
public BoundedExponentialBackoffRetry(int baseSleepTimeMs,
int maxRetries, int maxSleepTimeMs) {View on GitHub (pinned to cdb116e942)