NationalSecurityAgency/ghidra · error · IOException
PostgreSQL not found and must be built (see {}, view script
Error message
PostgreSQL not found and must be built (see {}, view script for details) What it means
Thrown when Application.getOSFile(POSTGRES) raises OSFileNotFoundException, meaning no OS-specific postgres bundle is installed at all. Unlike [677], the directory was never found, so the tool points the user to the build script.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:789
loadLibraryValue = postgresLibrary.getAbsolutePath();
}
/**
* Locate the "pg_ctl" executable within the PostgreSQL installation. Unpack the installation
* if it is not already.
* @throws IOException if postgres folder cannot be determined
*/
private void discoverPostgresInstall() throws IOException {
try {
postgresRoot = Application.getOSFile(POSTGRES); // find PostgreSQL build for os
postgresControl = new File(postgresRoot, "bin/pg_ctl");
if (!postgresControl.isFile()) {
throw new IOException("PostgreSQL pg_ctl command not found: " + postgresControl);
}
setupPostgresSharedLibrary();
}
catch (OSFileNotFoundException e) {
throw new IOException("PostgreSQL not found and must be built (see " +
POSTGRES_BUILD_SCRIPT + ", view script for details)");
}
}
/**
* Recover the parameter settings from a previously initialized server
* @param configFile is main configuration file: port, adminPassword, hostAuthentication
* @param hbaFile is the connection file
* @throws IOException if the server port is invalid
*/
private void recoverConfigurationParameters(File configFile, File hbaFile) throws IOException {
ServerConfig serverConfig = new ServerConfig();
serverConfig.addKey("port", "");
serverConfig.scanConfig(configFile);
String value = serverConfig.getValue("port");
int scannedPort = 5432;
if (value.length() != 0) {
scannedPort = Integer.parseInt(value);View on GitHub (pinned to d5f144c24d)
Solutions
- Run the referenced POSTGRES_BUILD_SCRIPT and follow its instructions to build postgres.
- Re-run the BSim command only after the build completes successfully.
- Confirm the build produced the OS-specific postgres layout Application.getOSFile expects.
Defensive patterns
Strategy: validation
Validate before calling
// Check whether the OS postgres bundle is resolvable before launching.
try {
File root = Application.getOSFile(POSTGRES);
if (root == null || !root.exists()) {
System.err.println("Postgres bundle not installed. Run " + POSTGRES_BUILD_SCRIPT);
return;
}
} catch (OSFileNotFoundException e) {
System.err.println("Postgres not built yet. Run " + POSTGRES_BUILD_SCRIPT);
return;
} Try / catch
try {
launchable.discoverPostgresInstall();
} catch (IOException e) {
if (e.getMessage().startsWith("PostgreSQL not found and must be built")) {
System.err.println("Build postgres first via the referenced script, then retry.");
}
throw e;
} Prevention
- Run the postgres build script during initial setup before any BSim server command.
- Confirm the build produced the OS-specific layout the tool expects.
- Surface a clear 'run the build script' message when the bundle is absent.
When it happens
Trigger: First-time setup on a machine where the postgres support bundle has not been built/downloaded; getOSFile cannot resolve any POSTGRES file for the OS (line 789).
Common situations: Fresh checkout/install without running the postgres build step, or the bundle not yet distributed for this platform.
Related errors
- PostgreSQL pg_ctl command not found: {}
- Error initializing postgres database
- Could not start postgres server process
- Could not create database:
- Cannot find Python source for {name}. If this is a remote s
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/1ac11aab16b9fc17.
Report an issue: GitHub.