{"record":{"id":"1abf0e19f27d295c","repo":"apache/hadoop","slug":"failed-to-specify-server-s-kerberos-principal-name","errorCode":null,"errorMessage":"Failed to specify server's Kerberos principal name","messagePattern":"Failed to specify server's Kerberos principal name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java","lineNumber":341,"sourceCode":"    String serverKeyPattern = conf.get(serverKey + \".pattern\");\n    if (serverKeyPattern != null && !serverKeyPattern.isEmpty()) {\n      Pattern pattern = GlobPattern.compile(serverKeyPattern);\n      if (!pattern.matcher(serverPrincipal).matches()) {\n        throw new IllegalArgumentException(String.format(\n            \"Server has invalid Kerberos principal: %s,\"\n                + \" doesn't match the pattern: %s\",\n            serverPrincipal, serverKeyPattern));\n      }\n    } else {\n      // check that the server advertised principal matches our conf\n      String confPrincipal = SecurityUtil.getServerPrincipal(\n          conf.get(serverKey), serverAddr.getAddress());\n      if (LOG.isDebugEnabled()) {\n        LOG.debug(\"getting serverKey: \" + serverKey + \" conf value: \" + conf.get(serverKey)\n            + \" principal: \" + confPrincipal);\n      }\n      if (confPrincipal == null || confPrincipal.isEmpty()) {\n        throw new IllegalArgumentException(\n            \"Failed to specify server's Kerberos principal name\");\n      }\n      KerberosName name = new KerberosName(confPrincipal);\n      if (name.getHostName() == null) {\n        throw new IllegalArgumentException(\n            \"Kerberos principal name does NOT have the expected hostname part: \"\n                + confPrincipal);\n      }\n      if (!serverPrincipal.equals(confPrincipal)) {\n        throw new IllegalArgumentException(String.format(\n            \"Server has invalid Kerberos principal: %s, expecting: %s\",\n            serverPrincipal, confPrincipal));\n      }\n    }\n    return serverPrincipal;\n  }\n\n  /**","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java#L323-L359","documentation":"Error \"Failed to specify server's Kerberos principal name\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the server Kerberos principal (e.g. via the protocol-specific principal config) before establishing the SASL connection.","Verify the keytab and principal are configured and the login (loginUserFromKeytab) succeeded.","Check logs for earlier Kerberos login failures that left the principal unset."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}