apache/hadoop · error · IllegalArgumentException
Server has invalid Kerberos principal: %s, expecting: %s
Error message
Server has invalid Kerberos principal: %s, expecting: %s
What it means
Error "Server has invalid Kerberos principal: %s, expecting: %s" thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:351
// check that the server advertised principal matches our conf
String confPrincipal = SecurityUtil.getServerPrincipal(
conf.get(serverKey), serverAddr.getAddress());
if (LOG.isDebugEnabled()) {
LOG.debug("getting serverKey: " + serverKey + " conf value: " + conf.get(serverKey)
+ " principal: " + confPrincipal);
}
if (confPrincipal == null || confPrincipal.isEmpty()) {
throw new IllegalArgumentException(
"Failed to specify server's Kerberos principal name");
}
KerberosName name = new KerberosName(confPrincipal);
if (name.getHostName() == null) {
throw new IllegalArgumentException(
"Kerberos principal name does NOT have the expected hostname part: "
+ confPrincipal);
}
if (!serverPrincipal.equals(confPrincipal)) {
throw new IllegalArgumentException(String.format(
"Server has invalid Kerberos principal: %s, expecting: %s",
serverPrincipal, confPrincipal));
}
}
return serverPrincipal;
}
/**
* Do client side SASL authentication with server via the given IpcStreams.
*
* @param ipcStreams ipcStreams.
* @return AuthMethod used to negotiate the connection
* @throws IOException raised on errors performing I/O.
*/
public AuthMethod saslConnect(IpcStreams ipcStreams) throws IOException {
// redefined if/when a SASL negotiation starts, can be queried if the
// negotiation fails
authMethod = AuthMethod.SIMPLE;View on GitHub (pinned to 2add963021)
Solutions
- Configure the server to use the expected Kerberos principal; the presented principal does not match what the client expects.
- Verify the keytab contains the expected principal and the service config references it.
- Check DNS so both client and server agree on the service hostname used in the principal.
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:351 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ef9ac58590ffda35.
Report an issue: GitHub.