{"id":"90fbc7f7f8351414","repo":"apache/kafka","slug":"unknown-configuration-s","errorCode":null,"errorMessage":"Unknown configuration '%s'","messagePattern":"Unknown configuration '(.+?)'","errorType":"validation","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java","lineNumber":178,"sourceCode":"     */\n    protected Map<String, Object> preProcessParsedConfig(Map<String, Object> parsedValues) {\n        return parsedValues;\n    }\n\n    /**\n     * Called directly after user configs got parsed (and thus default values got set).\n     * This allows to change default values for \"secondary defaults\" if required.\n     *\n     * @param parsedValues unmodifiable map of current configuration\n     * @return a map of updates that should be applied to the configuration (will be validated to prevent bad updates)\n     */\n    protected Map<String, Object> postProcessParsedConfig(Map<String, Object> parsedValues) {\n        return Map.of();\n    }\n\n    protected Object get(String key) {\n        if (!values.containsKey(key))\n            throw new ConfigException(String.format(\"Unknown configuration '%s'\", key));\n        used.add(key);\n        return values.get(key);\n    }\n\n    public void ignore(String key) {\n        used.add(key);\n    }\n\n    public Short getShort(String key) {\n        return (Short) get(key);\n    }\n\n    public Integer getInt(String key) {\n        return (Integer) get(key);\n    }\n\n    public Long getLong(String key) {\n        return (Long) get(key);","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/kafka/blob/c31c9215e131f8c17e79f8901b48c13ee6aa8e7a/clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java#L160-L196","documentation":"ConfigException thrown by AbstractConfig.get(String) when a requested configuration key is not present in the parsed `values` map. get() is the single backing method for all typed accessors (getShort, getInt, getLong, getDouble, getList, getBoolean, getString, getPassword, getClass). The error therefore means the key was never registered on the ConfigDef used to build this AbstractConfig, so the parsed map contains no entry (not even a default). It is a programming/definition error, distinct from a user typing an unknown config (which would be flagged separately as 'unused').","triggerScenarios":"Calling any config.getXxx(\"some.key\") where \"some.key\" was not defined via ConfigDef.define(...) on the ConfigDef passed to the AbstractConfig constructor. Commonly reached from application code or a Connector/Converter/ConfigProvider subclass that reads a key it forgot to define, or after renaming a key without updating both the definition and the call site.","commonSituations":"See trigger scenarios.","solutions":["Verify the exact key string: compare the argument to getString/getInt/etc. against the keys passed to ConfigDef.define(...) for this config's ConfigDef.","Ensure the key is defined (define(...) called) with the same constant on both the definition side and the read side; if you have a Key constant, use it in both places.","If the key was renamed/removed upstream, update the read site or restore the definition.","If reading a key that belongs to a different scope (worker vs connector vs producer), obtain it from the correct config object."],"exampleFix":"// before: key 'my.timeout.ms' is read but never defined\nint timeout = config.getInt(\"my.timeout.ms\"); // throws ConfigException: Unknown configuration 'my.timeout.ms'\n\n// after: define it on the ConfigDef first\nconfigDef.define(\"my.timeout.ms\", ConfigDef.Type.INT, 5000, ConfigDef.Importance.MEDIUM, \"timeout\");\nint timeout = config.getInt(\"my.timeout.ms\");","handlingStrategy":"validation","validationCode":"// Confirm the key exists in the parsed config before reading it.\nString key = \"my.config.key\";\nif (!config.values().containsKey(key)) {\n    throw new IllegalStateException(\"Required config '\" + key + \"' was not defined; check your ConfigDef / properties\");\n}\nObject value = config.values().get(key); // or use the typed getter only after the containsKey check","typeGuard":null,"tryCatchPattern":"try {\n    int v = config.getInt(key);\n} catch (org.apache.kafka.common.config.ConfigException ce) {\n    if (ce.getMessage().startsWith(\"Unknown configuration\")) {\n        // key was never declared in the ConfigDef (typo / missing definition)\n        log.error(\"Config key '{}' is not declared; fix ConfigDef or the property name\", key);\n    } else {\n        throw ce;\n    }\n}","preventionTips":["This is thrown by AbstractConfig.get/getInt/getString/etc. when the key was never declared in the ConfigDef — almost always a typo.","Centralise config-key strings as constants instead of typing them at call sites.","Call config.logUnused() / review 'these configurations were not used' warnings to catch mismatches early.","Unit-test your ConfigDef with a Properties map so missing keys fail in CI, not in production."],"tags":["configuration","kafka-client","configdef","programming-error"],"analyzedSha":"c31c9215e131f8c17e79f8901b48c13ee6aa8e7a","analyzedAt":"2026-08-03T12:34:05.770Z","schemaVersion":2}