{"record":{"id":"7d0b7767575b51cb","repo":"provectus/kafka-ui","slug":"error-parsing-acl-csv-file-no-lines-in-file","errorCode":null,"errorMessage":"Error parsing ACL csv file: no lines in file","messagePattern":"Error parsing ACL csv file: no lines in file","errorType":"validation","errorClass":"ValidationException","httpStatus":400,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/acl/AclCsv.java","lineNumber":68,"sourceCode":"        throw new ValidationException(\"Input csv is not valid - blank value in colum \" + i + \", line \" + line);\n      }\n    }\n    try {\n      return new AclBinding(\n          new ResourcePattern(\n              ResourceType.valueOf(values[1]), values[3], PatternType.valueOf(values[2])),\n          new AccessControlEntry(\n              values[0], values[6], AclOperation.valueOf(values[4]), AclPermissionType.valueOf(values[5]))\n      );\n    } catch (IllegalArgumentException enumParseError) {\n      throw new ValidationException(\"Error parsing enum value in line \" + line);\n    }\n  }\n\n  public static Collection<AclBinding> parseCsv(String csvString) {\n    String[] lines = csvString.split(LINE_SEPARATOR);\n    if (lines.length == 0) {\n      throw new ValidationException(\"Error parsing ACL csv file: no lines in file\");\n    }\n    boolean firstLineIsHeader = HEADER.equalsIgnoreCase(lines[0].trim().replace(\" \", \"\"));\n    Set<AclBinding> result = new HashSet<>();\n    for (int i = firstLineIsHeader ? 1 : 0; i < lines.length; i++) {\n      String line = lines[i];\n      if (!line.isBlank()) {\n        AclBinding aclBinding = parseCsvLine(line, i);\n        result.add(aclBinding);\n      }\n    }\n    return result;\n  }\n}\n","sourceCodeStart":50,"sourceCodeEnd":82,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/acl/AclCsv.java#L50-L82","documentation":"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.","triggerScenarios":"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).","commonSituations":"Empty file selected in the ACL import UI; truncated upload; wrong file path read producing empty content; failed export step upstream.","solutions":["Upload a non-empty CSV file containing the header and ACL rows","Check the file was read correctly before calling parseCsv (verify size/content)","Regenerate the CSV export","Validate the file client-side (non-empty, has expected header) before submitting"],"exampleFix":"// before\nString csv = Files.readString(path); // file was empty\nparseCsv(csv);\n// after\nString csv = Files.readString(path);\nif (csv == null || csv.isBlank()) throw new IllegalArgumentException(\"ACL csv file is empty\");\nparseCsv(csv);","handlingStrategy":"validation","validationCode":"// Java (caller)\nif (csvString == null || csvString.trim().isEmpty()) {\n  throw new IllegalArgumentException(\"ACL csv content is empty\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  Collection<AclBinding> bindings = AclCsv.parseCsv(csvString);\n} catch (ValidationException e) {\n  if (e.getMessage().contains(\"no lines in file\")) {\n    log.error(\"ACL import aborted: file is empty\");\n  } else { throw e; }\n}","preventionTips":["Check file size/content before upload","Ensure the export step succeeded (non-empty output file)","Require the header row to be present in imports","Fail fast client-side on empty bodies"],"tags":["kafka","acl","csv","validation"],"backgroundTag":"empty-result-set","analyzedSha":"83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7","analyzedAt":"2026-09-08T04:35:39.002Z","contentChangedAt":"2026-09-08T04:35:39.002Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}