NationalSecurityAgency/ghidra · error · IOException

Server is configured to run on port {}: Change in {}

Error message

Server is configured to run on port {}: Change in {}

What it means

Thrown by recoverConfigurationParameters when the port read from the existing server's config file (postgresql.conf via ServerConfig) differs from the port specified on the CLI (or implied). The tool refuses to silently override an already-configured server's port.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:810

	}

	/**
	 * 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);
		}
		if (port != -1 && (scannedPort != port)) {
			throw new IOException("Server is configured to run on port " +
				Integer.toString(scannedPort) + ": Change in " + POSTGRES_CONFIGFILE);
		}
		port = scannedPort;

		serverConfig.scanConnect(hbaFile);
		String localMethod = serverConfig.getLocalAuthentication();
		if (localMethod == null || localMethod.equals(TRUST_METHOD)) {
			localAuthentication = AUTHENTICATION_NONE;
		}
		else if (localMethod.equals(PASSWORD_METHOD)) {
			localAuthentication = AUTHENTICATION_PASSWORD;
		}
		else if (localMethod.equals(CERTIFICATE_METHOD)) {
			localAuthentication = AUTHENTICATION_PKI;
		}
		String hostMethod = serverConfig.getHostAuthentication();
		if (hostMethod == null || hostMethod.equals(TRUST_METHOD)) {
			hostAuthentication = AUTHENTICATION_NONE;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Omit --port to accept the port already configured in the server's config file.
  2. Edit POSTGRES_CONFIGFILE to change the recorded port, then re-run.
  3. If you intend a fresh configuration, point at a clean data directory / remove the old config.
Defensive patterns

Strategy: validation

Validate before calling

// Read the configured port from postgresql.conf and compare before passing --port.
int configured = readPortFromConfig(postgresqlConfFile); // absent => 5432
if (cliPort != -1 && cliPort != configured) {
    System.err.println("Port " + cliPort + " conflicts with configured " + configured);
    System.err.println("Omit --port or edit " + POSTGRES_CONFIGFILE);
    return;
}

Try / catch

try {
    launchable.recoverConfigurationParameters(configFile, hbaFile);
} catch (IOException e) {
    if (e.getMessage().startsWith("Server is configured to run on port")) {
        System.err.println("Drop --port to accept the configured port, or edit the config file.");
    }
    throw e;
}

Prevention

When it happens

Trigger: Running configure/upgrade against an existing server while passing --port that conflicts with the port recorded in the config file (line 810). Only fires when `port != -1` (i.e. a port was explicitly given) and it mismatches the scanned value.

Common situations: Migrating/reusing an existing server's data dir with a different port, changing ports after init, or leftover config from a prior instance.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/ab23fa0c08351ab8. Report an issue: GitHub.