apache/cassandra · error · IOException
Exception while executing the command:
Error message
Exception while executing the command:
What it means
FBUtilities.exec (the ProcessBuilder-based helper) runs an external command and throws this IOException when the process exits with a non-zero error code, embedding the command line, exit code, and combined stdout/stderr output. It indicates the external tool invocation failed.
Solutions
- Read the 'command output' section of the message to see the underlying tool's stderr
- Verify the command and its arguments are correct for the current platform
- Run the command manually on the host to reproduce and diagnose
- Handle the specific exit code in the caller or add the required tool/dependency on the host
Example fix
// before: FBUtilities.exec("fio", "--name=test", "--bad-option")
// after: FBUtilities.exec("fio", "--name=test", "--rw=read", "--size=1G") // valid args Defensive patterns
Strategy: try-catch
Validate before calling
if (!new File(command[0]).canExecute() && FBUtilities.exec("which", command[0]).isEmpty()) throw new IllegalStateException("tool not found: " + command[0]); Try / catch
try { FBUtilities.exec(cmd); } catch (IOException e) { logger.error("External command failed: {}", e.getMessage()); throw new RuntimeException(e); } Prevention
- Test external tool invocations manually with identical arguments
- Capture and log the tool's stderr on failure
- Verify tool availability and permissions on every node before use
When it happens
Trigger: Calling FBUtilities.exec(cmd) or execTimeout(...) where the spawned process returns a non-zero exit code, e.g. executing a native tool script that fails, missing arguments to the command, or a tool that errors on the host.
Common situations: Calls to external tools during repair/backup tooling, empty or wrong arguments to the command, the tool not supporting the requested operation on this OS, or environment issues (PATH, permissions) making the command fail after starting.
Related errors
- Command
- Attempted skipBytes() on a closed RAR
- Attempted to seek in a closed RAR
- Ballot file corrupted
- Can't open %r for reading
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/fbd1c8bd92fd446e.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/utils/FBUtilities.java:1221
public static void exec(ProcessBuilder pb) throws IOException
{
Process p = pb.start();
try
{
int errCode = p.waitFor();
if (errCode != 0)
{
try (BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())))
{
String lineSep = LINE_SEPARATOR.getString();
StringBuilder sb = new StringBuilder();
String str;
while ((str = in.readLine()) != null)
sb.append(str).append(lineSep);
while ((str = err.readLine()) != null)
sb.append(str).append(lineSep);
throw new IOException("Exception while executing the command: " + StringUtils.join(pb.command(), " ") +
", command error Code: " + errCode +
", command output: " + sb);
}
}
}
catch (InterruptedException e)
{
throw new UncheckedInterruptedException(e);
}
}
/**
* Starts and waits for the given <code>cmd</code> to finish. If the process does not finish within <code>timeout</code>,
* it will be destroyed.
*
* @param env additional environment variables to set
* @param timeout timeout for the process to finish, or zero/null to wait forever
* @param outBufSize the maximum size of the collected std output; the overflow will be discardedView on GitHub (pinned to 88fd0f6a0e)