nathanmarz/storm · error · IllegalArgumentException
invalid port
Error message
invalid port: ${port} What it means
The ThriftClient constructor rejects a port that is <= 0 with IllegalArgumentException("invalid port: "+port). A TCP connection requires a positive port number, so Storm validates the port before creating the TSocket.
Solutions
- Set the correct port in the config (e.g. nimbus.thrift.port: 6627) and pass it to the constructor.
- Pass a hardcoded or defaulted positive port: int port = portFromConf > 0 ? portFromConf : 6627;
- Check the config key you read the port from — a missing key or type mismatch commonly yields 0.
- Validate the parsed port before constructing the client.
Example fix
// before
int port = Integer.parseInt(conf.get("nimbus.thrift.port.custom", "0"));
ThriftClient client = new ThriftClient(conf, loginConf, host, port, null, null);
// after
int port = Integer.parseInt(conf.getProperty("nimbus.thrift.port"));
if (port <= 0) throw new IllegalArgumentException("port must be positive");
ThriftClient client = new ThriftClient(conf, loginConf, host, port, null, null); Defensive patterns
Strategy: validation
Validate before calling
// Java
int port = ObjectIntegerCast.getInt(conf.get(Config.NIMBUS_THRIFT_PORT), -1);
if (port <= 0) throw new IllegalArgumentException("invalid nimbus.thrift.port: " + port + "; must be > 0"); Type guard
boolean isValidPort(Object p) {
return p instanceof Number && ((Number) p).intValue() > 0 && ((Number) p).intValue() <= 65535;
} Try / catch
try {
client = new ThriftClient(conf, loginConf, host, port, timeout, asUser);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("invalid port")) {
LOG.error("Bad thrift port " + port + "; check nimbus.thrift.port in storm.yaml");
}
throw e;
} Prevention
- Always set nimbus.thrift.port (typically 6627) in storm.yaml.
- Validate ports are in 1..65535 when parsing from config or CLI.
- Prefer Config.NIMBUS_THRIFT_PORT constant over string literals to avoid key typos.
When it happens
Trigger: Constructing new ThriftClient(storm_conf, login_conf, host, port, ...) with port <= 0 — e.g. port read from an unset config key defaulting to 0, an int uninitialized field, or parsing a blank/invalid port string that yields 0.
Common situations: nimbus port config absent so Integer.parseInt of empty value or default 0 is used; copying a config template without filling the port; wiring the wrong config key that holds a non-port number; UI/drpc clients misconfigured with port 0.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- host is not set
- Could not find component common for
- Client is being closed, and does not take requests any more
- Client connection should not receive any messages
AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12).
Data as JSON: /api/errors/1e1a5d48130da399.
Report an issue: GitHub.
Appendix: source
Thrown at storm-core/src/jvm/backtype/storm/security/auth/ThriftClient.java:54
public ThriftClient(Map storm_conf, String host, int port) throws TTransportException {
this(storm_conf, host, port, null);
}
public ThriftClient(Map storm_conf, String host, int port, Integer timeout) throws TTransportException {
try {
//locate login configuration
Configuration login_conf = AuthUtils.GetConfiguration(storm_conf);
//construct a transport plugin
ITransportPlugin transportPlugin = AuthUtils.GetTransportPlugin(storm_conf, login_conf);
//create a socket with server
if(host==null) {
throw new IllegalArgumentException("host is not set");
}
if(port<=0) {
throw new IllegalArgumentException("invalid port: "+port);
}
TSocket socket = new TSocket(host, port);
if(timeout!=null) {
socket.setTimeout(timeout);
}
final TTransport underlyingTransport = socket;
//establish client-server transport via plugin
_transport = transportPlugin.connect(underlyingTransport, host);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
_protocol = null;
if (_transport != null)
_protocol = new TBinaryProtocol(_transport);
}
public TTransport transport() {View on GitHub (pinned to cdb116e942)