{"record":{"id":"f9607db8f728e33c","repo":"apache/hadoop","slug":"invalid-line-line","errorCode":null,"errorMessage":"Invalid line: \" + line","messagePattern":"Invalid line: \" \\+ line","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/TextFileRegionAliasMap.java","lineNumber":359,"sourceCode":"      @Override\n      public void remove() {\n        throw new UnsupportedOperationException();\n      }\n    }\n\n    private FileRegion nextInternal(Iterator<FileRegion> i) throws IOException {\n      BufferedReader r = iterators.get(i);\n      if (null == r) {\n        throw new IllegalStateException();\n      }\n      String line = r.readLine();\n      if (null == line) {\n        iterators.remove(i);\n        return null;\n      }\n      String[] f = line.split(delim);\n      if (f.length != 5 && f.length != 6) {\n        throw new IOException(\"Invalid line: \" + line);\n      }\n      byte[] nonce = new byte[0];\n      if (f.length == 6) {\n        nonce = Base64.getDecoder().decode(f[5]);\n      }\n      return new FileRegion(Long.parseLong(f[0]), new Path(f[1]),\n          Long.parseLong(f[2]), Long.parseLong(f[3]), Long.parseLong(f[4]),\n          nonce);\n    }\n\n    public InputStream createStream() throws IOException {\n      InputStream i = fs.open(file);\n      if (codec != null) {\n        i = codec.createInputStream(i);\n      }\n      return i;\n    }\n","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/TextFileRegionAliasMap.java#L341-L377","documentation":"TextReader parses each line of the provided-storage alias file by splitting on the configured delimiter (dfs.provided.aliasmap.text.delimiter). A valid FileRegion line must yield 5 fields (blockId, path, offset, length, length-under-management) or 6 with a base64 nonce; any other field count throws IOException naming the offending line.","triggerScenarios":"The file's actual delimiter differs from the configured one (commas in file, tabs configured), a required field is missing/extra, the file contains a header, comment, or blank line, or a path itself contains the delimiter and splits a field in two.","commonSituations":"Hand-authored or externally generated alias files; a generating job written with one delimiter and a reader configured with the default; editing the file and dropping a column; file ending with a stray partial line after a truncated write.","solutions":["Look at the exact line in the message — count the fields and compare with the expected 'blockId,path,offset,length,length[,nonce]' layout","Make writer and reader agree on dfs.provided.aliasmap.text.delimiter, and regenerate the file with TextFileRegionAliasMap's own writer rather than by hand","Strip header/comment/blank lines and any malformed trailing fragment"],"exampleFix":"# before (delimiter mismatch, file uses tabs, config default is used)\n12345,/blocks/1,0,1024,1024,nonce\n\n# after: file fields match configured delimiter, 5 or 6 columns\n12345\t/blocks/1\t0\t1024\t1024\n# with hdfs-site.xml: dfs.provided.aliasmap.text.delimiter = \\t","handlingStrategy":"validation","validationCode":"// Validate the alias file before handing it to the reader\ntry (BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(file)))) {\n  String line; int n = 0;\n  while ((line = br.readLine()) != null) {\n    n++;\n    int fields = line.split(Pattern.quote(delim), -1).length;\n    if (fields != 5 && fields != 6) {\n      throw new IllegalArgumentException(\n          \"Alias file line \" + n + \" has \" + fields + \" fields (need 5 or 6): \" + line);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  for (FileRegion r : textReader) { /* ... */ }\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid line:\")) {\n    // fix the file / delimiter config; log the offending line and fail the job\n  }\n  throw e;\n}","preventionTips":["Generate alias files only with TextFileRegionAliasMap's writer so delimiter/format always match","Pin dfs.provided.aliasmap.text.delimiter identically on writer and reader configs","Run a format lint over generated alias files before pointing the DN at them"],"tags":["provided-storage","aliasmap","text","parse-error","delimiter","file-format"],"backgroundTag":"malformed-data-file","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}