NationalSecurityAgency/ghidra · error · IllegalArgumentException
Expecting privilege option (admin or user)
Error message
Expecting privilege option (admin or user)
What it means
Thrown by scanPrivilege() when the privilege argument is present but is neither `admin` nor `user`. BSim maps exactly those two strings to the adminPrivilegeRequested flag; anything else is rejected.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:989
/**
* Scan command-line for a particular privilege level. Administrator privileges are
* requested with the exact String "admin", anything is a request for a read-only user
* @param params are the command-line arguments
* @param slot is the position to retrieve the user name argument
* @throws IllegalArgumentException the privilege parameter is missing
*/
private void scanPrivilege(String[] params, int slot) throws IllegalArgumentException {
if (params.length <= slot) {
throw new IllegalArgumentException("Missing desired privilege (admin or user)");
}
if (params[slot].equals("admin")) {
adminPrivilegeRequested = true;
}
else if (params[slot].equals("user")) {
adminPrivilegeRequested = false;
}
else {
throw new IllegalArgumentException("Expecting privilege option (admin or user)");
}
}
/**
* Start a PostgreSQL server, configured for BSim, on the local host.
* If the data directory is already populated, the server process is simply restarted.
* If the data directory is empty, a new server configuration is established, and the server is started.
* Authentication may be necessary, either via password or certificate, in order to enable
* the BSim extension on the server
*
* @throws IOException if postgres cannot be started
* @throws InterruptedException if the process fails during the run
* @throws SAXException if the data directory cannot be initialized
* @throws GeneralSecurityException if the authentication fails
*/
private void startCommand()
throws IOException, InterruptedException, SAXException, GeneralSecurityException {
discoverPostgresInstall();View on GitHub (pinned to d5f144c24d)
Solutions
- Use exactly `admin` or `user` (lowercase).
- Double-check spelling and case.
- Consult usage help for the accepted literal values.
Example fix
// before bsim_ctl changeprivilege alice administrator // after bsim_ctl changeprivilege alice admin
Defensive patterns
Strategy: type-guard
Validate before calling
Set<String> allowed = Set.of("admin", "user");
if (!allowed.contains(args[privilegeSlot])) {
throw new IllegalArgumentException(
"Privilege must be one of " + allowed + ", got: " + args[privilegeSlot]);
} Type guard
public boolean isValidPrivilege(String v) {
return "admin".equals(v) || "user".equals(v);
} Try / catch
try {
bsimControl.exec(args);
} catch (IllegalArgumentException e) {
if ("Expecting privilege option (admin or user)".equals(e.getMessage())) {
throw new UserFacingException("Use exactly 'admin' or 'user' (lowercase)", e);
}
throw e;
} Prevention
- Normalize/sanity-check privilege to the exact literals before invoking.
- Avoid synonyms like administrator/superuser in scripts.
When it happens
Trigger: Passing `bsim_ctl changeprivilege alice administrator`, `... readwrite`, `... true`, or any value other than `admin`/`user`.
Common situations: Using a synonym (administrator/superuser/readwrite); passing a boolean; case mismatch (Admin/USER); locale-specific word.
Related errors
- Missing desired privilege (admin or user)
- %s: unknown demangling style `%s'
- Missing data directory
- Data directory {} does not exist
- Missing username
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/a36edc51979c67a1.
Report an issue: GitHub.