{"record":{"id":"586f1c2388b92e9f","repo":"apache/hadoop","slug":"invalid-transport-s","errorCode":null,"errorMessage":"Invalid transport: %s","messagePattern":"Invalid transport: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java","lineNumber":316,"sourceCode":"    // transport\n    simpleKdc.setWorkDir(workDir);\n    simpleKdc.setKdcHost(getHost());\n    simpleKdc.setKdcRealm(realm);\n    if (transport == null) {\n      transport = conf.getProperty(TRANSPORT);\n    }\n    if (port == 0) {\n      port = NetworkUtil.getServerPort();\n    }\n    if (transport != null) {\n      if (transport.trim().equals(\"TCP\")) {\n        simpleKdc.setKdcTcpPort(port);\n        simpleKdc.setAllowUdp(false);\n      } else if (transport.trim().equals(\"UDP\")) {\n        simpleKdc.setKdcUdpPort(port);\n        simpleKdc.setAllowTcp(false);\n      } else {\n        throw new IllegalArgumentException(\"Invalid transport: \" + transport);\n      }\n    } else {\n      throw new IllegalArgumentException(\"Need to set transport!\");\n    }\n    simpleKdc.getKdcConfig().setString(KdcConfigKey.KDC_SERVICE_NAME,\n            conf.getProperty(INSTANCE));\n    if (conf.getProperty(DEBUG) != null) {\n      krb5Debug = getAndSet(SUN_SECURITY_KRB5_DEBUG, conf.getProperty(DEBUG));\n    }\n    if (conf.getProperty(MIN_TICKET_LIFETIME) != null) {\n      simpleKdc.getKdcConfig().setLong(KdcConfigKey.MINIMUM_TICKET_LIFETIME,\n          Long.parseLong(conf.getProperty(MIN_TICKET_LIFETIME)));\n    }\n    if (conf.getProperty(MAX_TICKET_LIFETIME) != null) {\n      simpleKdc.getKdcConfig().setLong(KdcConfigKey.MAXIMUM_TICKET_LIFETIME,\n          Long.parseLong(conf.getProperty(MiniKdc.MAX_TICKET_LIFETIME)));\n    }\n  }","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java#L298-L334","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nProperties conf = new Properties();\nconf.setProperty(\"transport\", \"tcp\"); // throws Invalid transport: tcp\n\n// after\nProperties conf = MiniKdc.createConf(); // defaults include transport=TCP\nconf.setProperty(\"org.name\", \"EXAMPLE\");\nconf.setProperty(\"transport\", \"TCP\"); // explicit and correctly cased","handlingStrategy":"validation","validationCode":"String t = conf.getProperty(\"transport\");\nPreconditions.checkArgument(\n    \"TCP\".equals(t.trim()) || \"UDP\".equals(t.trim()),\n    \"minikdc transport must be TCP or UDP (case-sensitive), got: %s\", t);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["kerberos","minikdc","configuration","case-sensitivity"],"backgroundTag":"invalid-configuration-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}