{"record":{"id":"9ade3bf494c69c21","repo":"apache/kafka","slug":"unexpected-config-source-source","errorCode":null,"errorMessage":"Unexpected config source {source}","messagePattern":"Unexpected config source (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java","lineNumber":2948,"sourceCode":"                configSource = ConfigEntry.ConfigSource.DYNAMIC_TOPIC_CONFIG;\n                break;\n            case DYNAMIC_BROKER_CONFIG:\n                configSource = ConfigEntry.ConfigSource.DYNAMIC_BROKER_CONFIG;\n                break;\n            case DYNAMIC_DEFAULT_BROKER_CONFIG:\n                configSource = ConfigEntry.ConfigSource.DYNAMIC_DEFAULT_BROKER_CONFIG;\n                break;\n            case STATIC_BROKER_CONFIG:\n                configSource = ConfigEntry.ConfigSource.STATIC_BROKER_CONFIG;\n                break;\n            case DYNAMIC_BROKER_LOGGER_CONFIG:\n                configSource = ConfigEntry.ConfigSource.DYNAMIC_BROKER_LOGGER_CONFIG;\n                break;\n            case DEFAULT_CONFIG:\n                configSource = ConfigEntry.ConfigSource.DEFAULT_CONFIG;\n                break;\n            default:\n                throw new IllegalArgumentException(\"Unexpected config source \" + source);\n        }\n        return configSource;\n    }\n\n    @Override\n    public AlterConfigsResult incrementalAlterConfigs(Map<ConfigResource, Collection<AlterConfigOp>> configs,\n                                                      final AlterConfigsOptions options) {\n        final Map<ConfigResource, KafkaFutureImpl<Void>> allFutures = new HashMap<>();\n        // BROKER_LOGGER requests always go to a specific, constant broker or controller node.\n        //\n        // BROKER resource changes for a specific (non-default) resource go to either that specific\n        // node (if using bootstrap.servers), or directly to the active controller (if using\n        // bootstrap.controllers)\n        //\n        // All other requests go to the least loaded broker (if using bootstrap.servers) or the\n        // active controller (if using bootstrap.controllers)\n        final Collection<ConfigResource> unifiedRequestResources = new ArrayList<>();\n","sourceCodeStart":2930,"sourceCodeEnd":2966,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L2930-L2966","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nConfigResource r = new ConfigResource(Type.BROKER, \"1\");\nadmin.describeConfigs(Collections.singleton(r)).all().get(); // older client, newer broker\n\n// after: upgrade client dependency\n// implementation 'org.apache.kafka:kafka-clients:<newer-or-equal-version>'","handlingStrategy":"try-catch","validationCode":"// no client-side mitigation; ensure client version >= broker version","typeGuard":null,"tryCatchPattern":"try {\n    admin.describeConfigs(Collections.singleton(r)).all().get();\n} catch (ExecutionException e) {\n    if (e.getCause() instanceof IllegalArgumentException\n        && e.getCause().getMessage().contains(\"Unexpected config source\")) {\n        // upgrade kafka-clients to match the broker, then retry\n    }\n}","preventionTips":["Keep kafka-clients version at or above the broker version.","Avoid downgrading the client below the broker."],"tags":["kafka-admin","config-management","version-skew","protocol"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}