apache/hadoop · error · IOException
missing destination argument
Error message
missing destination argument
What it means
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.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CopyCommands.java:382
items.add(new PathData(new URI(arg), getConf()));
} catch (URISyntaxException e) {
if (Path.WINDOWS) {
// Unlike URI, PathData knows how to parse Windows drive-letter paths.
items.add(new PathData(arg, getConf()));
} else {
throw new IOException("Unexpected URISyntaxException: " + e.toString());
}
}
}
return items;
}
@Override
protected void processOptions(LinkedList<String> args)
throws IOException {
if (args.size() < 2) {
throw new IOException("missing destination argument");
}
CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "n");
cf.parse(args);
appendToNewBlock = cf.getOpt("n");
getRemoteDestination(args);
super.processOptions(args);
}
@Override
protected void processArguments(LinkedList<PathData> args)
throws IOException {
if (!dst.exists) {
dst.fs.create(dst.path, false).close();
}
InputStream is = null;View on GitHub (pinned to 2add963021)
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)
Example fix
# before
hadoop fs -appendToFile $LOCAL_FILE $DEST # $DEST is empty -> missing destination argument
# after
[ -n "$DEST" ] || { echo "DEST is empty" >&2; exit 1; }
hadoop fs -appendToFile "$LOCAL_FILE" "$DEST" Defensive patterns
Strategy: validation
Validate before calling
if (args.size() < 2) {
throw new IOException("missing destination argument");
} Try / catch
try {
// invoke appendToFile
} catch (IOException e) {
if (e.getMessage().contains("missing destination argument")) {
// fix the argument list (source + destination required) and retry
}
} Prevention
- 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
When it happens
Trigger: 'hadoop fs -appendToFile local.txt' (no HDFS destination); calling with only flags; a script where $DEST expanded to empty so the destination argument vanished.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- stdin (-) must be the sole input argument when present
- Illegal option {}
- Not enough arguments: expected {} but got {}
- Too many arguments: expected {} but got {}
- Target path not specified. <target path> <src path> <src pat
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f446fc33e0b81b0d.
Report an issue: GitHub.