apache/cassandra · error · UnsupportedCallbackException

Unrecognized Callback:

Error message

Unrecognized Callback: 

What it means

AuthenticationProxy's callback handler answers NameCallback and PasswordCallback from the supplied username/password, but throws UnsupportedCallbackException for any other callback type the JAAS login module requests, with message 'Unrecognized Callback: <class>'.

Source

Thrown at src/java/org/apache/cassandra/auth/jmx/AuthenticationProxy.java:157

            {
                String[] strings = (String[]) credentials;
                if (strings[0] != null)
                    username = strings[0].toCharArray();
                if (strings[1] != null)
                    password = strings[1].toCharArray();
            }
        }

        public void handle(Callback[] callbacks) throws UnsupportedCallbackException
        {
            for (int i = 0; i < callbacks.length; i++)
            {
                if (callbacks[i] instanceof NameCallback)
                    ((NameCallback)callbacks[i]).setName(username == null ? null : new String(username));
                else if (callbacks[i] instanceof PasswordCallback)
                    ((PasswordCallback)callbacks[i]).setPassword(password == null ? null : password);
                else
                    throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback: " + callbacks[i].getClass().getName());
            }
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Configure a JAAS login module that only requires username/password callbacks (e.g. a Cassandra-compatible password login module).
  2. If a custom module is required, extend the callback handler to support the additional callback types.
  3. Remove interactive/other modules from the JAAS config used for JMX authentication.

Example fix

// before (JAAS config)
CassandraJMXAuth {
  com.sun.security.auth.module.Krb5LoginModule required
    useKeyTab=true;
};
// after (username/password module)
CassandraJMXAuth {
  org.apache.cassandra.auth.CassandraLoginModule required;
};
Defensive patterns

Strategy: try-catch

Try / catch

try {
    loginContext.login();
} catch (LoginException e) {
    Throwable cause = e;
    while (cause != null) {
        if (cause instanceof UnsupportedCallbackException) {
            // login module needs callbacks beyond name/password; fix module choice
            break;
        }
        cause = cause.getCause();
    }
}

Prevention

When it happens

Trigger: A JAAS login module configured for JMX authentication requires callbacks beyond name/password (e.g. TextInputCallback, ChoiceCallback, LanguageCallback), and handle() cannot supply them.

Common situations: Using a generic/login-module expecting interactive prompts (e.g. com.sun.security.auth.module.Krb5LoginModule or UI-based modules) instead of a simple user/password module like Cassandra's own or UnixLoginModule replacements.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/2f3a5cf2b3139c85. Report an issue: GitHub.