provectus/kafka-ui · error · ValidationException
Input csv is not valid - there should be 7 columns in line
Error message
Input csv is not valid - there should be 7 columns in line
What it means
AclCsv.parseCsvLine splits each ACL CSV line on the separator and requires exactly 7 columns (principal, resourceType, patternType, resourceName, operation, permission, host). When the split yields a different count, a ValidationException is thrown with the offending line number.
Solutions
- Open the CSV and make every data line contain exactly 7 comma-separated values
- Fix the specific line number reported in the message
- Quote fields that may contain commas or wrap the file in proper CSV quoting
- Validate the file with the expected header (PRINCIPAL,RESOURCE_TYPE,...) before import
Example fix
// before User:alice,Topic,read // after User:alice,TOPIC,LITERAL,my-topic,READ,ALLOW,*
Defensive patterns
Strategy: validation
Validate before calling
// Java (caller)
boolean validLine = line.split(",").length == 7;
if (!validLine) throw new IllegalArgumentException("ACL CSV line " + n + " must have 7 columns"); Try / catch
try {
Collection<AclBinding> bindings = AclCsv.parseCsv(csv);
} catch (ValidationException e) {
if (e.getMessage().contains("7 columns")) {
int lineNo = Integer.parseInt(e.getMessage().replaceAll(".*line ", ""));
log.error("Fix column count on ACL CSV line {}", lineNo);
} else { throw e; }
} Prevention
- Keep ACL CSVs to exactly 7 columns: PRINCIPAL,RESOURCE_TYPE,PATTERN_TYPE,RESOURCE_NAME,OPERATION,PERMISSION_TYPE,HOST
- Include the canonical header row so structure is self-documenting
- Quote fields that may contain commas
- Lint the CSV (column count + non-blank cells) before import
When it happens
Trigger: Uploading/applying an ACL CSV where a line has fewer or more than 7 comma-separated fields — e.g. a missing host column, an embedded unquoted comma in the resource name, or a truncated line.
Common situations: Hand-edited CSVs; files exported from other tools with different column orders; missing trailing columns; stray header/footer lines; copy-paste losing a field.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Input csv is not valid - blank value in colum
- Error parsing ACL csv file: no lines in file
- Error parsing enum value in line
- seekTo should be set if seekType is
- ANY operation can be only part of filter
AI-assisted analysis of provectus/kafka-ui@83b5a60cc0 (2026-09-08).
Data as JSON: /api/errors/b353e02fb713a95a.
Report an issue: GitHub.
Appendix: source
Thrown at kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/acl/AclCsv.java:46
public static String createAclString(AclBinding binding) {
var pattern = binding.pattern();
var filter = binding.toFilter().entryFilter();
return String.format(
"%s,%s,%s,%s,%s,%s,%s",
filter.principal(),
pattern.resourceType(),
pattern.patternType(),
pattern.name(),
filter.operation(),
filter.permissionType(),
filter.host()
);
}
private static AclBinding parseCsvLine(String csv, int line) {
String[] values = csv.split(VALUES_SEPARATOR);
if (values.length != 7) {
throw new ValidationException("Input csv is not valid - there should be 7 columns in line " + line);
}
for (int i = 0; i < values.length; i++) {
if ((values[i] = values[i].trim()).isBlank()) {
throw new ValidationException("Input csv is not valid - blank value in colum " + i + ", line " + line);
}
}
try {
return new AclBinding(
new ResourcePattern(
ResourceType.valueOf(values[1]), values[3], PatternType.valueOf(values[2])),
new AccessControlEntry(
values[0], values[6], AclOperation.valueOf(values[4]), AclPermissionType.valueOf(values[5]))
);
} catch (IllegalArgumentException enumParseError) {
throw new ValidationException("Error parsing enum value in line " + line);
}
}
View on GitHub (pinned to 83b5a60cc0)