NationalSecurityAgency/ghidra · error · IOException
{inputFile.getAbsolutePath()} is not an XML file
Error message
{inputFile.getAbsolutePath()} is not an XML file What it means
Thrown by queryPair when the inputFile argument does not satisfy isFile() — meaning the path does not exist, is a directory, or is otherwise not a readable regular file. Despite the message text saying 'is not an XML file', the check is purely a filesystem existence/type test; it does not inspect file contents.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BulkSignatures.java:889
pairs.add(pairInput);
}
return count;
}
/**
* Compares pairs of functions specified in an input (XML) file, and writes
* the results to an output file.
*
* @param inputFile input XML file
* @param outputFile output XML file
* @throws IOException if there is a problem establishing the server connection
* @throws SAXException if an XML parse error occurs
* @throws LSHException if there is a problem querying the database
*/
protected void queryPair(File inputFile, File outputFile)
throws IOException, SAXException, LSHException {
if (!inputFile.isFile()) {
throw new IOException(inputFile.getAbsolutePath() + " is not an XML file");
}
if (outputFile.isFile()) {
Msg.info(this, "Overwriting file " + outputFile.getAbsolutePath());
outputFile.delete();
}
establishQueryServerConnection(true);
QueryPair query = new QueryPair();
query.pairs = new ArrayList<PairInput>();
ErrorHandler handler = SpecXmlUtils.getXmlHandler();
XmlPullParser parser = XmlPullParserFactory.create(inputFile, handler, false);
parser.start("querypair");
try (FileWriter writer = new FileWriter(outputFile)) {
writer.append("<responsepair>\n");
ResponsePair.Accumulator accumulator = new ResponsePair.Accumulator();
ResponsePair finalResponse = new ResponsePair();
int count = readQueryPairs(parser, 20, query.pairs);
while (count != 0) {View on GitHub (pinned to d5f144c24d)
Solutions
- Verify the path exists and is a regular file before calling queryPair (check inputFile.isFile() in the caller).
- Use absolute paths to avoid ambiguity about the working directory.
- Check file permissions on the path and parent directory.
- If the file should have been generated by a prior step, verify that step completed successfully.
Example fix
// before
if (!inputFile.isFile()) {
throw new IOException(inputFile.getAbsolutePath() + " is not an XML file");
}
// after — clearer message distinguishing missing vs wrong type
if (!inputFile.exists()) {
throw new IOException("Input file does not exist: " + inputFile.getAbsolutePath());
}
if (!inputFile.isFile()) {
throw new IOException("Input path is not a regular file: " + inputFile.getAbsolutePath());
} Defensive patterns
Strategy: validation
Validate before calling
// Validate the input file before calling queryPair
if (inputFile == null || !inputFile.isFile()) {
throw new IllegalArgumentException(
"Input file must exist and be a regular file: " +
(inputFile != null ? inputFile.getAbsolutePath() : "null"));
}
// Optionally check XML header
try (var r = new java.io.BufferedReader(new java.io.FileReader(inputFile))) {
String firstLine = r.readLine();
if (firstLine != null && !firstLine.startsWith("<?xml") && !firstLine.startsWith("<querypair")) {
// warn: file exists but may not be valid BSim pair XML
}
} Type guard
// Check before calling queryPair
public static boolean isValidPairInputFile(File f) {
return f != null && f.isFile() && f.canRead();
} Try / catch
try {
bulk.queryPair(inputFile, outputFile);
} catch (IOException e) {
if (e.getMessage().contains("is not an XML file")) {
// File path issue — verify path and retry
System.err.println("Check input path: " + inputFile.getAbsolutePath());
}
throw e;
} Prevention
- Always pass absolute file paths to BSim tools.
- Validate inputFile.isFile() in the caller before invoking queryPair.
- Check file readability with canRead() to catch permission issues early.
When it happens
Trigger: Calling queryPair(inputFile, outputFile) where inputFile points to a directory, a non-existent path, or a path the process cannot stat. The check is inputFile.isFile() returning false.
Common situations: Typo or wrong relative path in a command-line invocation; passing a directory path instead of the intended XML file; the file was cleaned up by another process before this method runs; insufficient permissions causing isFile() to return false.
Related errors
- {resultFolder.getAbsolutePath()} is not a valid directory
- Executable
- Expecting privilege option (admin or user)
- host required
- Non-empty dbName required
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/71a7ee04e339bee7.
Report an issue: GitHub.