provectus/kafka-ui · error · ValidationException

Error parsing enum value in line

Error message

Error parsing enum value in line 

What it means

AclCsv.parseCsvLine builds a Kafka AclBinding using ResourceType, PatternType, AclOperation and AclPermissionType enums via valueOf. If any of these strings is not a valid enum constant, the caught IllegalArgumentException is rethrown as 'Error parsing enum value in line <n>'.

Solutions

  1. Use exact uppercase Kafka enum names: ResourceType (TOPIC, GROUP, ...), PatternType (LITERAL, PREFIXED, ...), AclOperation (READ, WRITE, ALL, ...), AclPermissionType (ALLOW, DENY)
  2. Check case-sensitivity — valueOf is exact-match
  3. Inspect line number in the message and fix only that line
  4. Generate the CSV from a template with fixed enum columns

Example fix

// before
User:alice,topic,LITERAL,my-topic,read,allow,*
// after
User:alice,TOPIC,LITERAL,my-topic,READ,ALLOW,*
Defensive patterns

Strategy: validation

Validate before calling

// Java (caller)
Set<String> resTypes = Set.of("TOPIC","GROUP","CLUSTER","TRANSACTIONAL_ID","DELEGATION_TOKEN");
Set<String> patternTypes = Set.of("LITERAL","PREFIXED","ANY","MATCH","TYPE");
Set<String> ops = Set.of("READ","WRITE","CREATE","DELETE","ALTER","DESCRIBE","ALL", /* ... */);
Set<String> perms = Set.of("ALLOW","DENY","ANY");
// check values[i] for i in {1,2,4,5} against these sets before parsing

Try / catch

try {
  Collection<AclBinding> bindings = AclCsv.parseCsv(csv);
} catch (ValidationException e) {
  if (e.getMessage().startsWith("Error parsing enum value")) {
    log.error("Invalid enum name in ACL CSV: {}", e.getMessage()); // fix case/spelling
  } else { throw e; }
}

Prevention

When it happens

Trigger: CSV containing misspelled or lowercase enum values, e.g. resourceType 'topic' instead of 'TOPIC', operation 'read' instead of 'READ', or an unknown pattern type.

Common situations: CSVs written by hand or generated by tools using different naming conventions; older Kafka enum names; translated/localized field values; case-sensitivity mistakes.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of provectus/kafka-ui@83b5a60cc0 (2026-09-08). Data as JSON: /api/errors/8d94d0c799fa7182. Report an issue: GitHub.

Appendix: source

Thrown at kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/acl/AclCsv.java:61

  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);
    }
  }

  public static Collection<AclBinding> parseCsv(String csvString) {
    String[] lines = csvString.split(LINE_SEPARATOR);
    if (lines.length == 0) {
      throw new ValidationException("Error parsing ACL csv file: no lines in file");
    }
    boolean firstLineIsHeader = HEADER.equalsIgnoreCase(lines[0].trim().replace(" ", ""));
    Set<AclBinding> result = new HashSet<>();
    for (int i = firstLineIsHeader ? 1 : 0; i < lines.length; i++) {
      String line = lines[i];
      if (!line.isBlank()) {
        AclBinding aclBinding = parseCsvLine(line, i);
        result.add(aclBinding);
      }
    }
    return result;

View on GitHub (pinned to 83b5a60cc0)