alibaba/arthas · error · IllegalArgumentException
batch file do not exist: {batchFile}
Error message
batch file do not exist: {batchFile} What it means
TelnetConsole, when no inline --command is supplied, falls back to reading commands from a batch file (-b/--batch-file). It constructs new File(batchFile) and, if !file.exists(), throws IllegalArgumentException("batch file do not exist: <path>"). The check is existence only — not readability or regular-file status.
Source
Thrown at client/src/main/java/com/taobao/arthas/client/TelnetConsole.java:240
CommandLine commandLine = cli.parse(Arrays.asList(args));
CLIConfigurator.inject(commandLine, telnetConsole);
if (telnetConsole.isHelp()) {
System.out.println(usage(cli));
return STATUS_OK;
}
// Try to read cmds
List<String> cmds = new ArrayList<String>();
if (telnetConsole.getCommand() != null) {
for (String c : telnetConsole.getCommand().split(";")) {
cmds.add(c.trim());
}
} else if (telnetConsole.getBatchFile() != null) {
File file = new File(telnetConsole.getBatchFile());
if (!file.exists()) {
throw new IllegalArgumentException("batch file do not exist: " + telnetConsole.getBatchFile());
} else {
cmds.addAll(readLines(file));
}
}
final ConsoleReader consoleReader = new ConsoleReader(System.in, System.out);
consoleReader.setHandleUserInterrupt(true);
Terminal terminal = consoleReader.getTerminal();
// support catch ctrl+c event
terminal.disableInterruptCharacter();
if (terminal instanceof UnixTerminal) {
((UnixTerminal) terminal).disableLitteralNextCharacter();
}
try {
int width = TerminalSupport.DEFAULT_WIDTH;
int height = TerminalSupport.DEFAULT_HEIGHT;View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Confirm the batch file exists at the resolved absolute path before invoking (test -f).
- Pass an absolute path to -b to remove working-directory ambiguity.
- Ensure any pipeline step that generates the batch file completed successfully.
- On containers, mount the host file/directory containing the batch file.
Example fix
# before
java -jar arthas-client.jar -b ./cmds.txt <host>
# after
java -jar arthas-client.jar -b "$(pwd)/cmds.txt" <host>
test -f "$(pwd)/cmds.txt" || { echo missing; exit 1; } Defensive patterns
Strategy: validation
Validate before calling
File f = new File(batchFile).getAbsoluteFile();
if (!f.isFile()) {
throw new FileNotFoundException("batch file missing: " + f);
} Type guard
static boolean batchFileReady(String path) {
return path != null && new File(path).isFile();
} Try / catch
try {
TelnetConsole.main(args);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("batch file do not exist")) {
// fix path / generate the file, then retry
} else throw e;
} Prevention
- Pass an absolute path to -b/--batch-file.
- test -f the file in your launcher script before invoking.
- Generate batch files with an explicit final step and check its exit code.
When it happens
Trigger: Invoking the Arthas telnet client with -b <path> where the path does not exist (typo, relative path resolved from unexpected CWD, file not yet created, container path not mounted).
Common situations: Relative batch-file path run from a different working directory; file generated by a prior pipeline step that failed; path inside a container that was not volume-mounted; permissions/ownership hiding the file.
Related errors
- {fileName} do not exist, arthas home: {arthasHome}
- illegal arthas home: {arthasHome}
- zero length message
- can not find arthas-core.jar under arthasHome: ${arthasHome}
- Failed to create directory within ${TEMP_DIR_ATTEMPTS} attem
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/440b380df480dc88.
Report an issue: GitHub.