{"record":{"id":"f446fc33e0b81b0d","repo":"apache/hadoop","slug":"missing-destination-argument","errorCode":null,"errorMessage":"missing destination argument","messagePattern":"missing destination argument","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java","lineNumber":382,"sourceCode":"          items.add(new PathData(new URI(arg), getConf()));\n        } catch (URISyntaxException e) {\n          if (Path.WINDOWS) {\n            // Unlike URI, PathData knows how to parse Windows drive-letter paths.\n            items.add(new PathData(arg, getConf()));\n          } else {\n            throw new IOException(\"Unexpected URISyntaxException: \" + e.toString());\n          }\n        }\n      }\n      return items;\n    }\n\n    @Override\n    protected void processOptions(LinkedList<String> args)\n        throws IOException {\n\n      if (args.size() < 2) {\n        throw new IOException(\"missing destination argument\");\n      }\n\n      CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, \"n\");\n      cf.parse(args);\n      appendToNewBlock = cf.getOpt(\"n\");\n      getRemoteDestination(args);\n      super.processOptions(args);\n    }\n\n    @Override\n    protected void processArguments(LinkedList<PathData> args)\n        throws IOException {\n\n      if (!dst.exists) {\n        dst.fs.create(dst.path, false).close();\n      }\n\n      InputStream is = null;","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java#L364-L400","documentation":"IOException('missing destination argument') thrown by AppendToFile.processOptions (CopyCommands.java:382) when fewer than 2 arguments remain after option parsing. appendToFile requires at least one source (local file or '-') AND one destination, so args.size() < 2 means the destination (or both arguments) was omitted.","triggerScenarios":"'hadoop fs -appendToFile local.txt' (no HDFS destination); calling with only flags; a script where $DEST expanded to empty so the destination argument vanished.","commonSituations":"Unset/empty environment variables in cron or CI scripts; shell quoting mistakes that swallow the last argument; commands copy/pasted without the trailing destination token.","solutions":["Supply both arguments: 'hadoop fs -appendToFile local.txt /hdfs/log.txt'","If the destination comes from a variable, guard the script: [ -n \"$DEST\" ] || { echo 'DEST unset'; exit 1; }","Check the exact command line the failing job/launcher executes (print it before running)"],"exampleFix":"# before\nhadoop fs -appendToFile $LOCAL_FILE $DEST   # $DEST is empty -> missing destination argument\n\n# after\n[ -n \"$DEST\" ] || { echo \"DEST is empty\" >&2; exit 1; }\nhadoop fs -appendToFile \"$LOCAL_FILE\" \"$DEST\"","handlingStrategy":"validation","validationCode":"if (args.size() < 2) {\n  throw new IOException(\"missing destination argument\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  // invoke appendToFile\n} catch (IOException e) {\n  if (e.getMessage().contains(\"missing destination argument\")) {\n    // fix the argument list (source + destination required) and retry\n  }\n}","preventionTips":["Remember appendToFile needs at least one input AND a destination","Guard destination variables: [ -n \"$DEST\" ] || exit 1","Echo the assembled command before executing it in scripts"],"tags":["hadoop","appendtofile","shell","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}