NationalSecurityAgency/ghidra · error · IOException

Parsing error

Error message

Parsing error

What it means

Thrown by ServerConfig.ConnectionEntry.parse when a line of the PostgreSQL connection configuration file (pg_hba.conf style) splits into fewer than 4 whitespace-separated fields. The parser expects at least type, database, user, and method fields, so a too-short line is rejected.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java:215

				if (address.equals("127.0.0.1/32")) {	// IPv4 localhost
					return true;
				}
				if (address.equals("::1/128")) {		// IPv6 localhost
					return true;
				}
			}
			return false;
		}

		/**
		 * Parse the fields out of a line of the connection file
		 * @param line the text to parse
		 * @throws IOException if the text is not formatted properly to parse
		 */
		public void parse(String line) throws IOException {
			String[] split = line.split(" +");		// Split on whitespace
			if (split.length < 4) {
				throw new IOException("Parsing error");
			}
			type = split[0];
			database = split[1];
			user = split[2];
			int nextPos = 3;
			if (type.equals("local")) {		// "local" type has no address
				address = null;
			}
			else {
				address = split[3];
				nextPos = 4;
			}
			if (nextPos >= split.length) {
				throw new IOException("Parsing error");
			}
			method = split[nextPos];
			nextPos += 1;
			if (nextPos >= split.length) {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Open the connection config file and find the offending line: ensure it has at least 4 whitespace-separated fields (type database user [address] method).
  2. For non-local types the line needs 5 fields (with an address); for 'local' type it needs at least 4.
  3. Prefix genuine comments with '#' so they are not parsed as entries.
  4. Remove stray blank or partial lines.

Example fix

// before (config file line)
local   all   all
// after
local   all   all   md5
Defensive patterns

Strategy: validation

Validate before calling

// Validate a connection config line before handing it to parse
String[] split = line.trim().split(" +");
boolean isLocal = split.length > 0 && split[0].equals("local");
int minFields = isLocal ? 4 : 5;
if (split.length < 4) {
    throw new IllegalArgumentException(
        "Connection config line has too few fields (need >= 4): " + line);
}
entry.parse(line);

Try / catch

try {
    entry.parse(line);
} catch (IOException e) {
    if (e.getMessage().equals("Parsing error")) {
        log.error("Malformed connection config line: '{}'", line);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling parse(line) on a connection-file line where line.split(" +") yields fewer than 4 tokens. This covers blank-ish lines, lines with stray words, or truncated entries that never reach the required minimum field count.

Common situations: Editing the BSim server connection config file and leaving an incomplete line. A copy-paste that dropped fields. Comment lines that do not start with '#' but contain too few tokens. Trailing whitespace/encoding artifacts that collapse fields.

Related errors


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