provectus/kafka-ui · error · ValidationException

Error parsing ACL csv file: no lines in file

Error message

Error parsing ACL csv file: no lines in file

What it means

AclCsv.parseCsv splits the uploaded ACL CSV into lines and rejects input that produces no lines at all with 'Error parsing ACL csv file: no lines in file'. It expects at least a header or data rows to convert into AclBindings.

Solutions

  1. Upload a non-empty CSV file containing the header and ACL rows
  2. Check the file was read correctly before calling parseCsv (verify size/content)
  3. Regenerate the CSV export
  4. Validate the file client-side (non-empty, has expected header) before submitting

Example fix

// before
String csv = Files.readString(path); // file was empty
parseCsv(csv);
// after
String csv = Files.readString(path);
if (csv == null || csv.isBlank()) throw new IllegalArgumentException("ACL csv file is empty");
parseCsv(csv);
Defensive patterns

Strategy: validation

Validate before calling

// Java (caller)
if (csvString == null || csvString.trim().isEmpty()) {
  throw new IllegalArgumentException("ACL csv content is empty");
}

Try / catch

try {
  Collection<AclBinding> bindings = AclCsv.parseCsv(csvString);
} catch (ValidationException e) {
  if (e.getMessage().contains("no lines in file")) {
    log.error("ACL import aborted: file is empty");
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling parseCsv with a null-adjacent/empty string or a string containing only separators that split to a zero-length array (e.g. empty upload body).

Common situations: Empty file selected in the ACL import UI; truncated upload; wrong file path read producing empty content; failed export step upstream.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

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

        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)