apache/hadoop · error · IllegalArgumentException
Invalid transport: %s
Error message
Invalid transport: %s
What it means
During MiniKdc startup (prepareKdcServer), the 'transport' property must equal TCP or UDP. The comparison transport.trim().equals("TCP") is case-sensitive: any value other than exactly TCP or UDP after whitespace trimming throws IllegalArgumentException. Lowercase 'tcp'/'udp' are rejected.
Source
Thrown at hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java:316
// transport
simpleKdc.setWorkDir(workDir);
simpleKdc.setKdcHost(getHost());
simpleKdc.setKdcRealm(realm);
if (transport == null) {
transport = conf.getProperty(TRANSPORT);
}
if (port == 0) {
port = NetworkUtil.getServerPort();
}
if (transport != null) {
if (transport.trim().equals("TCP")) {
simpleKdc.setKdcTcpPort(port);
simpleKdc.setAllowUdp(false);
} else if (transport.trim().equals("UDP")) {
simpleKdc.setKdcUdpPort(port);
simpleKdc.setAllowTcp(false);
} else {
throw new IllegalArgumentException("Invalid transport: " + transport);
}
} else {
throw new IllegalArgumentException("Need to set transport!");
}
simpleKdc.getKdcConfig().setString(KdcConfigKey.KDC_SERVICE_NAME,
conf.getProperty(INSTANCE));
if (conf.getProperty(DEBUG) != null) {
krb5Debug = getAndSet(SUN_SECURITY_KRB5_DEBUG, conf.getProperty(DEBUG));
}
if (conf.getProperty(MIN_TICKET_LIFETIME) != null) {
simpleKdc.getKdcConfig().setLong(KdcConfigKey.MINIMUM_TICKET_LIFETIME,
Long.parseLong(conf.getProperty(MIN_TICKET_LIFETIME)));
}
if (conf.getProperty(MAX_TICKET_LIFETIME) != null) {
simpleKdc.getKdcConfig().setLong(KdcConfigKey.MAXIMUM_TICKET_LIFETIME,
Long.parseLong(conf.getProperty(MiniKdc.MAX_TICKET_LIFETIME)));
}
}View on GitHub (pinned to 2add963021)
Solutions
- Set the 'transport' property to the exact uppercase string "TCP" or "UDP"
- Build the configuration from MiniKdc.createConf() and override only what you need, so defaults remain valid
- Assert the value in test setup: check conf.getProperty("transport").trim() is "TCP" or "UDP" before constructing MiniKdc
Example fix
// before
Properties conf = new Properties();
conf.setProperty("transport", "tcp"); // throws Invalid transport: tcp
// after
Properties conf = MiniKdc.createConf(); // defaults include transport=TCP
conf.setProperty("org.name", "EXAMPLE");
conf.setProperty("transport", "TCP"); // explicit and correctly cased Defensive patterns
Strategy: validation
Validate before calling
String t = conf.getProperty("transport");
Preconditions.checkArgument(
"TCP".equals(t.trim()) || "UDP".equals(t.trim()),
"minikdc transport must be TCP or UDP (case-sensitive), got: %s", t); Prevention
- Start from MiniKdc.createConf() instead of an empty Properties so defaults like transport=TCP are always present
- Remember this comparison is case-sensitive: only uppercase TCP/UDP pass
- Centralize minikdc config construction in one helper so invalid values cannot leak into tests
When it happens
Trigger: A Properties config with transport set to "tcp" or "udp" (lowercase), an empty string, a typo like "TPC", or any other value. Leading/trailing whitespace is tolerated by trim(), but case is not.
Common situations: Copy-pasting configs where other Hadoop properties are case-insensitive; hand-built Properties instead of MiniKdc.createConf() (which defaults transport to "TCP"); editing minikdc.properties files for test harnesses.
Related errors
- Missing configuration properties: %s
- Need to set transport!
- Invalid rule: ${remaining}
- Invalid rule mechanism: ${ruleMech}
- Server asks us to fall back to SIMPLE auth, but this client
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/586f1c2388b92e9f.
Report an issue: GitHub.