NationalSecurityAgency/ghidra · error · IOException

Missing role in pg_ident.conf entry

Error message

Missing role in pg_ident.conf entry

What it means

Thrown by ServerConfig.IdentEntry.parse when, after reading the map-name and system-name fields, there is no remaining content for the required role field (pos >= line.length() after skipping whitespace). Every pg_ident.conf entry must have exactly three fields, so a missing third field is rejected.

Source

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

				throw new IOException("Missing system-name in pg_ident.conf entry");
			}
			else if (line.charAt(pos) == '"') {
				systemNameIsQuoted = true;
				endpos = parseDoubleQuote(pos, line);
				if (line.charAt(endpos - 1) != '"') {
					throw new IOException("Entry missing ending quote in pg_ident.conf");
				}
				systemName = line.substring(pos + 1, endpos - 1);		// Strip quotes
			}
			else {
				systemNameIsQuoted = false;
				endpos = parseField(pos, line);
				systemName = line.substring(pos, endpos);
			}

			pos = skipWhiteSpace(endpos, line);
			if (pos >= line.length()) {
				throw new IOException("Missing role in pg_ident.conf entry");
			}
			else if (line.charAt(pos) == '"') {
				roleNameIsQuoted = true;
				endpos = parseDoubleQuote(pos, line);
				if (line.charAt(endpos - 1) != '"') {
					throw new IOException("Entry missing ending quote in pg_ident.conf");
				}
				roleName = line.substring(pos + 1, endpos - 1);		// Strip quotes
			}
			else {
				roleNameIsQuoted = false;
				endpos = parseField(pos, line);
				roleName = line.substring(pos, endpos);
			}
			return true;
		}

		public void emit(Writer writer) throws IOException {

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Add the missing role (PostgreSQL role) field as the third token.
  2. Use the full three-field form: mapname systemusername rolename.
  3. Remove incomplete lines or comment them out with '#'.

Example fix

// before (pg_ident.conf line)
mymap   myuser
// after
mymap   myuser   myrole
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the role (third) field is present before parsing
String[] split = line.trim().split("\\s+");
if (split.length < 3) {
    throw new IllegalArgumentException(
        "pg_ident.conf entry missing the role field: " + line);
}
identEntry.parse(line);

Try / catch

try {
    identEntry.parse(line);
} catch (IOException e) {
    if (e.getMessage().contains("Missing role")) {
        log.error("pg_ident.conf entry missing role field: '{}'", line);
    }
    throw e;
}

Prevention

When it happens

Trigger: Parsing a pg_ident.conf line that has map-name and system-name but no role token, e.g. 'mymap myuser' with nothing after.

Common situations: A truncated pg_ident.conf line missing the role field. Editing the file and deleting the third column. Copy-paste that dropped the last field.

Related errors


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