{"record":{"id":"63fb6fbe3255eb57","repo":"apache/hadoop","slug":"expecting-additional-output-after-line-line","errorCode":null,"errorMessage":"Expecting additional output after line: ${line}","messagePattern":"Expecting additional output after line: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DF.java","lineNumber":186,"sourceCode":"        sb.append(\": \" + output.get(0));\n      }\n      throw new IOException(sb.toString());\n    }\n    \n    String line = output.get(1);\n    StringTokenizer tokens =\n      new StringTokenizer(line, \" \\t\\n\\r\\f%\");\n    \n    try {\n      this.filesystem = tokens.nextToken();\n    } catch (NoSuchElementException e) {\n      throw new IOException(\"Unexpected empty line\");\n    }\n    if (!tokens.hasMoreTokens()) {            // for long filesystem name\n      if (output.size() > 2) {\n        line = output.get(2);\n      } else {\n        throw new IOException(\"Expecting additional output after line: \"\n            + line);\n      }\n      tokens = new StringTokenizer(line, \" \\t\\n\\r\\f%\");\n    }\n\n    try {\n      Long.parseLong(tokens.nextToken()); // capacity\n      Long.parseLong(tokens.nextToken()); // used\n      Long.parseLong(tokens.nextToken()); // available\n      Integer.parseInt(tokens.nextToken()); // pct used\n      this.mount = tokens.nextToken();\n    } catch (NoSuchElementException e) {\n      throw new IOException(\"Could not parse line: \" + line);\n    } catch (NumberFormatException e) {\n      throw new IOException(\"Could not parse line: \" + line);\n    }\n  }\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DF.java#L168-L204","documentation":"DF handles device names longer than the df column: when the filesystem token fills the whole first line with no more tokens on it, DF re-reads the NEXT output line to find the numbers. If there is no third line (<output.size() > 2> fails), it throws IOException 'Expecting additional output after line: <line>'. This is the long-device-name wrap case with nothing wrapped underneath.","triggerScenarios":"Running DF against a volume whose df output wraps: very long NFS export names, LVM/device-mapper paths (/dev/mapper/very-long-vg-name-lv), or bind mounts pushing the device token alone onto line 1, while the numeric fields did not follow on a subsequent line.","commonSituations":"DataNode/NodeManager volumes on long-named LVM or NFS mounts; cloud images with verbose device-mapper names; older Hadoop versions whose DF parser is stricter about the wrap.","solutions":["Check the actual output shape: df -k <datadir> | cat -A - if the device wraps onto its own line but numbers are missing, that mount cannot be parsed by this DF version.","Point data directories at a mount with a short device name (label/mount via fstab with a stable short path) or use a bind-mount alias.","Upgrade Hadoop - DF parsing of wrapped/long device names has been improved in later releases.","As a workaround for pure capacity checks, substitute a different mechanism (java.io.File.getUsableSpace) in your own tooling instead of DF."],"exampleFix":"# before\n# /dev/mapper/a-very-long-volume-group-name--that-wraps appears alone on its df line\n# DF.parseOutput(): IOException: Expecting additional output after line: ...\n\n# after: expose the volume under a short, stable bind mount and use it for data dirs\nsudo mkdir -p /grid1\nsudo mount --bind /dev/mapper/a-very-long-volume-group-name--that-wraps /grid1\n# dfs.datanode.data.dir=/grid1/dn  ->  df -k /grid1/dn parses cleanly","handlingStrategy":"try-catch","validationCode":"// pre-check: the numeric row must contain >= 5 tokens\n// run 'df -k <dir>' yourself; if the device token occupies a whole line with no\n// following numeric line, that volume cannot be used with DF-based accounting","typeGuard":null,"tryCatchPattern":"try {\n  df.getMount();\n} catch (IOException e) { // 'Expecting additional output after line:'\n  // repoint data dirs at a short-named bind mount or different volume\n}","preventionTips":["Keep data volumes under short, stable mount paths (bind mounts) especially for LVM/NFS.","Validate 'df -k <datadir>' parses sanely during storage provisioning.","Upgrade Hadoop when DF parser hardening ships."],"tags":["hadoop","disk","df","parsing","lvm","nfs","long-device-name"],"backgroundTag":"df-command-output-parse-failure","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}