NationalSecurityAgency/ghidra · error · IOException
Missing ident file: {}
Error message
Missing ident file: {} What it means
Thrown by addCertificateName() (init flow) when pg_ident.conf is not a regular file in the data directory. BSim patches pg_ident.conf to map the certificate's common name to the connecting user; without the file the mapping cannot be written.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:1123
command.add(dataDirectory.getAbsolutePath());
command.add("-s");
int res = runCommand(null, command, loadLibraryVar, loadLibraryValue);
if (res != 0) {
throw new IOException("Error creating new user");
}
}
/**
* Update the PostgreSQL identity map (pg_ident.conf) adding a map from
* the currently active -commonName- to -username-
* @param username the user name to add
* @throws IOException if the postgres ident file is invalid
*/
private void addCertificateName(String username) throws IOException {
File identFile = new File(dataDirectory, POSTGRES_IDENTFILE);
File copyFile = new File(dataDirectory, POSTGRES_IDENTFILE + ".copy");
if (!identFile.isFile()) {
throw new IOException("Missing ident file: " + identFile.getAbsolutePath());
}
ServerConfig.patchIdent(identFile, copyFile, POSTGRES_MAP_IDENTIFIER, commonName, username,
true);
FileUtilities.copyFile(copyFile, identFile, false, null);
}
/**
* Add a new user to the currently running server on the local host.
* A connection is established, using the local interface, and the "CREATE ROLE" command
* is executed. If the server is configured to require certificate authentication on
* remote connections, the user must have provided a distinguished name associated with
* the certificate, which is then mapped to the new username.
* @throws GeneralSecurityException if using PKI and no Distinguished Name is found
* @throws Exception if there's a problem initializing the Application of discovering the Postgres installation
*/
private void addUserCommand() throws GeneralSecurityException, Exception {
discoverPostgresInstall();
initializeDataDirectory(); // Needed to pick up authentication settingsView on GitHub (pinned to d5f144c24d)
Solutions
- Confirm pg_ident.conf exists in the data directory; create an empty one if postgres didn't (`touch <dataDir>/pg_ident.conf`).
- Re-initialize the data directory cleanly if it is incomplete.
- Check read permissions on the data directory.
- Ensure the postgres major version is one BSim expects (generates pg_ident.conf).
Defensive patterns
Strategy: validation
Validate before calling
File ident = new File(dataDir, "pg_ident.conf");
if (!ident.isFile()) {
// create an empty map file so BSim can patch it, if appropriate for your setup
ident.createNewFile();
} Type guard
public boolean identFileExists(File dir) {
return new File(dir, "pg_ident.conf").isFile();
} Try / catch
try {
bsimControl.start(args);
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Missing ident file:")) {
throw new UserFacingException("pg_ident.conf missing in data dir; (re)initialize the cluster", e);
}
throw e;
} Prevention
- Use a postgres version that generates pg_ident.conf on init.
- Avoid deleting pg_ident.conf from the data directory.
- Re-init the cluster if the data directory is incomplete.
When it happens
Trigger: During initializeDataDirectory() PKI setup, `new File(dataDirectory, POSTGRES_IDENTFILE).isFile()` is false right after postgres init.
Common situations: Postgres version/config that does not generate pg_ident.conf by default; the file was deleted; permissions prevent seeing the file; partial/failed earlier init left the data directory incomplete.
Related errors
- PKI authentication requested, but certificate authority file
- {} is not a valid certification authority
- Distinguished name option (--dn) required for {}
- Error copying original connection file
- Error creating new user
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/183fc113e1ea7167.
Report an issue: GitHub.