NationalSecurityAgency/ghidra · error · IllegalArgumentException
Invalid absolute file path:
Error message
Invalid absolute file path:
What it means
Thrown by cleanupFilename() when the file-type database path, after trimming and backslash-to-slash conversion, is not an absolute path. The path must start with '/' (Unix absolute) or match the Windows drive-letter pattern (isWindowsFilePath), and must not end with a trailing '/'. Throws IllegalArgumentException.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java:257
}
else if (pwdSep > 0 && (userinfo.length() - pwdSep) == 0) {
throw new IllegalArgumentException("Invalid userinfo specified");
}
return userinfo;
}
private static String cleanupFilename(String name) {
// transform dbName into acceptable H2 DB file path
Matcher m = BAD_H2_CHARS_PATTERN.matcher(name);
if (m.matches()) {
throw new IllegalArgumentException("Bad character in H2 database path. " +
"Disallowed characters: " + BAD_H2_CHARS);
}
String dbName = name.trim();
dbName = dbName.replace("\\", "/");
if ((!dbName.startsWith("/") && !isWindowsFilePath(dbName)) || dbName.endsWith("/")) {
throw new IllegalArgumentException("Invalid absolute file path: " + dbName);
}
if (!dbName.endsWith(H2_FILE_EXTENSION)) {
dbName += H2_FILE_EXTENSION;
}
return dbName;
}
private static String checkURLField(String val, String name) {
if (StringUtils.isEmpty(val)) {
throw new IllegalArgumentException("Invalid " + name + " in URL");
}
return val.trim();
}
/**
* Determine if this server info corresponds to Windows OS file path.
* @return true if this server info corresponds to Windows OS file path.
*/View on GitHub (pinned to d5f144c24d)
Solutions
- Provide an absolute path starting with '/' (Unix) or a drive letter (Windows), e.g. '/opt/bsim/data.mv.db'.
- Remove any trailing slash from the path.
- Resolve relative paths to absolute with java.nio.file.Path.toAbsolutePath() before constructing.
Example fix
// before (relative path)
new BSimServerInfo("data/bsim.mv.db");
// after (absolute path)
Path abs = Path.of("data/bsim.mv.db").toAbsolutePath();
new BSimServerInfo(abs.toString()); Defensive patterns
Strategy: validation
Validate before calling
String p = dbName.trim().replace("\\", "/");
boolean isWinDrive = p.length() >= 2 && p.charAt(1) == ':';
if ((!p.startsWith("/") && !isWinDrive) || p.endsWith("/")) {
throw new IllegalArgumentException("BSim file path must be absolute and not end with '/': " + p);
} Prevention
- Always pass an absolute path (or Windows drive path) to file-type BSimServerInfo.
- Resolve relative paths with Path.toAbsolutePath() before constructing.
- Strip trailing slashes produced by directory-join logic.
When it happens
Trigger: Constructing a file-type BSimServerInfo with a relative path like 'bsim.mv.db' or 'data/bsim.mv.db', or a path ending in '/', e.g. 'new BSimServerInfo("/opt/bsim/")'.
Common situations: Passing a relative working-directory path instead of an absolute one; trailing slash from directory join logic; Windows path not recognized as a drive path.
Related errors
- Remote file URL not supported: {}
- Bad character in H2 database path. Disallowed characters:
- host required
- Non-empty dbName required
- Invalid {} dbName: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/fa6527b786c7ff9b.
Report an issue: GitHub.