{"record":{"id":"3508378ead66301e","repo":"NationalSecurityAgency/ghidra","slug":"missing-role-in-pg-ident-conf-entry","errorCode":null,"errorMessage":"Missing role in pg_ident.conf entry","messagePattern":"Missing role in pg_ident\\.conf entry","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java","lineNumber":406,"sourceCode":"\t\t\t\tthrow new IOException(\"Missing system-name in pg_ident.conf entry\");\n\t\t\t}\n\t\t\telse if (line.charAt(pos) == '\"') {\n\t\t\t\tsystemNameIsQuoted = true;\n\t\t\t\tendpos = parseDoubleQuote(pos, line);\n\t\t\t\tif (line.charAt(endpos - 1) != '\"') {\n\t\t\t\t\tthrow new IOException(\"Entry missing ending quote in pg_ident.conf\");\n\t\t\t\t}\n\t\t\t\tsystemName = line.substring(pos + 1, endpos - 1);\t\t// Strip quotes\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsystemNameIsQuoted = false;\n\t\t\t\tendpos = parseField(pos, line);\n\t\t\t\tsystemName = line.substring(pos, endpos);\n\t\t\t}\n\n\t\t\tpos = skipWhiteSpace(endpos, line);\n\t\t\tif (pos >= line.length()) {\n\t\t\t\tthrow new IOException(\"Missing role in pg_ident.conf entry\");\n\t\t\t}\n\t\t\telse if (line.charAt(pos) == '\"') {\n\t\t\t\troleNameIsQuoted = true;\n\t\t\t\tendpos = parseDoubleQuote(pos, line);\n\t\t\t\tif (line.charAt(endpos - 1) != '\"') {\n\t\t\t\t\tthrow new IOException(\"Entry missing ending quote in pg_ident.conf\");\n\t\t\t\t}\n\t\t\t\troleName = line.substring(pos + 1, endpos - 1);\t\t// Strip quotes\n\t\t\t}\n\t\t\telse {\n\t\t\t\troleNameIsQuoted = false;\n\t\t\t\tendpos = parseField(pos, line);\n\t\t\t\troleName = line.substring(pos, endpos);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic void emit(Writer writer) throws IOException {","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java#L388-L424","documentation":"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.","triggerScenarios":"Parsing a pg_ident.conf line that has map-name and system-name but no role token, e.g. 'mymap myuser' with nothing after.","commonSituations":"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.","solutions":["Add the missing role (PostgreSQL role) field as the third token.","Use the full three-field form: mapname systemusername rolename.","Remove incomplete lines or comment them out with '#'."],"exampleFix":"// before (pg_ident.conf line)\nmymap   myuser\n// after\nmymap   myuser   myrole","handlingStrategy":"validation","validationCode":"// Ensure the role (third) field is present before parsing\nString[] split = line.trim().split(\"\\\\s+\");\nif (split.length < 3) {\n    throw new IllegalArgumentException(\n        \"pg_ident.conf entry missing the role field: \" + line);\n}\nidentEntry.parse(line);","typeGuard":null,"tryCatchPattern":"try {\n    identEntry.parse(line);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Missing role\")) {\n        log.error(\"pg_ident.conf entry missing role field: '{}'\", line);\n    }\n    throw e;\n}","preventionTips":["Every pg_ident.conf entry must have three fields; the third is the role.","Remove or comment incomplete lines.","Lint the file for three-field completeness before deployment."],"tags":["bsim","server-config","config-parsing","postgresql","pg-ident"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}