apache/kafka · error · IllegalArgumentException
Unexpected config source {source}
Error message
Unexpected config source {source} What it means
An IllegalArgumentException thrown in the switch that maps protocol ConfigSource values to ConfigEntry.ConfigSource. It fires only on the default case, meaning the broker returned a ConfigSource code the client does not recognize. This is almost always a client/broker version mismatch rather than user error.
Source
Thrown at clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:2948
configSource = ConfigEntry.ConfigSource.DYNAMIC_TOPIC_CONFIG;
break;
case DYNAMIC_BROKER_CONFIG:
configSource = ConfigEntry.ConfigSource.DYNAMIC_BROKER_CONFIG;
break;
case DYNAMIC_DEFAULT_BROKER_CONFIG:
configSource = ConfigEntry.ConfigSource.DYNAMIC_DEFAULT_BROKER_CONFIG;
break;
case STATIC_BROKER_CONFIG:
configSource = ConfigEntry.ConfigSource.STATIC_BROKER_CONFIG;
break;
case DYNAMIC_BROKER_LOGGER_CONFIG:
configSource = ConfigEntry.ConfigSource.DYNAMIC_BROKER_LOGGER_CONFIG;
break;
case DEFAULT_CONFIG:
configSource = ConfigEntry.ConfigSource.DEFAULT_CONFIG;
break;
default:
throw new IllegalArgumentException("Unexpected config source " + source);
}
return configSource;
}
@Override
public AlterConfigsResult incrementalAlterConfigs(Map<ConfigResource, Collection<AlterConfigOp>> configs,
final AlterConfigsOptions options) {
final Map<ConfigResource, KafkaFutureImpl<Void>> allFutures = new HashMap<>();
// BROKER_LOGGER requests always go to a specific, constant broker or controller node.
//
// BROKER resource changes for a specific (non-default) resource go to either that specific
// node (if using bootstrap.servers), or directly to the active controller (if using
// bootstrap.controllers)
//
// All other requests go to the least loaded broker (if using bootstrap.servers) or the
// active controller (if using bootstrap.controllers)
final Collection<ConfigResource> unifiedRequestResources = new ArrayList<>();
View on GitHub (pinned to 996fb4585a)
Solutions
- Upgrade the client to match or exceed the broker version so it knows the new ConfigSource codes.
- If you cannot upgrade, avoid the config operation that surfaces the unknown source, or filter response entries defensively.
- Report the unknown source code to narrow down which broker version introduced it.
Example fix
// before ConfigResource r = new ConfigResource(Type.BROKER, "1"); admin.describeConfigs(Collections.singleton(r)).all().get(); // older client, newer broker // after: upgrade client dependency // implementation 'org.apache.kafka:kafka-clients:<newer-or-equal-version>'
Defensive patterns
Strategy: try-catch
Validate before calling
// no client-side mitigation; ensure client version >= broker version
Try / catch
try {
admin.describeConfigs(Collections.singleton(r)).all().get();
} catch (ExecutionException e) {
if (e.getCause() instanceof IllegalArgumentException
&& e.getCause().getMessage().contains("Unexpected config source")) {
// upgrade kafka-clients to match the broker, then retry
}
} Prevention
- Keep kafka-clients version at or above the broker version.
- Avoid downgrading the client below the broker.
When it happens
Trigger: Calling Admin.describeConfigs or alterConfigs against a broker that returns a ConfigSource enum value newer than the client knows about, then mapping that response through incrementalAlterConfigs/describeConfigs handling.
Common situations: Newer broker adding a config source type (e.g. a new dynamic scope) while the client is on an older version; downgrade scenarios where the client is newer than the broker and a code was removed; custom/patched brokers emitting non-standard codes.
Related errors
- Buffer underflow while parsing response for request with hea
- The response is unrelated to Sasl request since its correlat
- The upgradeType flag should be set to SAFE_DOWNGRADE or UNSA
- Cannot specify a negative version level.
- TransactionalId `{transactionalId}` was not included in the
AI-assisted analysis of apache/kafka@996fb4585a (2026-08-11).
Data as JSON: /api/errors/9ade3bf494c69c21.
Report an issue: GitHub.