apache/kafka · error · ConfigException
Configuration 'name' values must not be empty.
Error message
Configuration 'name' values must not be empty.
What it means
Thrown by ValidList.validateIndividualValues when iterating the elements of a list config and encountering an element that is an empty String. Unlike the top-level 'must not be empty' (which guards the whole list), this guards individual members: a list may be non-empty but still contain "" as one of its items, which Kafka treats as invalid.
Source
Thrown at clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java:1087
String validString = this.validString.validStrings.isEmpty() ? "any non-empty value" : this.validString.toString();
throw new ConfigException("Configuration '" + name + "' must not be empty. Valid values include: " + validString);
}
if (Set.copyOf(values).size() != values.size()) {
throw new ConfigException("Configuration '" + name + "' values must not be duplicated.");
}
validateIndividualValues(name, values);
}
private void validateIndividualValues(String name, List<Object> values) {
boolean hasValidStrings = !validString.validStrings.isEmpty();
for (Object value : values) {
if (value instanceof String) {
String string = (String) value;
if (string.isEmpty()) {
throw new ConfigException("Configuration '" + name + "' values must not be empty.");
}
if (hasValidStrings) {
validString.ensureValid(name, value);
}
}
}
}
public String toString() {
return !validString.validStrings.isEmpty() ? validString.toString() : "";
}
}
public static class ValidString implements Validator {
final List<String> validStrings;
private ValidString(List<String> validStrings) {
this.validStrings = validStrings;View on GitHub (pinned to c31c9215e1)
Solutions
- Remove empty tokens from the comma-separated value (fix 'a,,b' to 'a,b', drop leading/trailing commas).
- Sanitize the raw string before assignment: value.replaceAll("(^,|,$|(?<=,),)", "").
- If empty elements are intentional in your pipeline, filter them out before passing the list to ConfigDef.
Example fix
// before
props.put("my.list.config", "read,,write,");
// after
props.put("my.list.config", "read,write"); Defensive patterns
Strategy: validation
Validate before calling
// Strip empty strings from list values before constructing the client:
for (Map.Entry<String, Object> e : new HashMap<>(props).entrySet()) {
if (e.getValue() instanceof List<?>) {
List<?> cleaned = ((List<?>) e.getValue()).stream()
.filter(el -> !(el instanceof String) || !((String) el).isEmpty())
.collect(Collectors.toList());
props.put(e.getKey(), cleaned);
}
} Type guard
null
Try / catch
try {
def.parse(props);
} catch (ConfigException ce) {
if (ce.getMessage().endsWith("values must not be empty.")) {
stripEmptiesAndRetry(props, ce.getName());
} else throw ce;
} Prevention
- When splitting 'a,,b,c' on ',', filter out empty tokens before storing in the props map.
- Treat a list containing an empty string as a parser bug in your config loader, not as valid input.
- Use a CSV parser that can report empty fields rather than silently emitting them.
When it happens
Trigger: A ConfigKey using ValidList receives a list like ["a", "", "c"]. Common when the raw value is "a,,c" (consecutive/trailing comma) and the split logic yields an empty token. Triggered during ConfigDef.parse() inside the per-element loop in validateIndividualValues.
Common situations: Comma-separated configs with stray commas ("a,,b"), leading/trailing commas (",a,b" or "a,b,"), or whitespace-only entries that the splitter collapses to empty. Frequent when properties files are edited by hand or generated by templating systems.
Related errors
- Configuration 'name' must not be empty. Valid values include
- Configuration 'name' values must not be duplicated.
- String must be non-empty
- String may not be empty
- Configuration 'name' values must not be null.
AI-assisted analysis of apache/kafka@c31c9215e1 (2026-08-03).
Data as JSON: /data/errors/82c137fffb56bb99.json.
Report an issue: GitHub.