{"record":{"id":"3c5cf89a0dbb07a6","repo":"NationalSecurityAgency/ghidra","slug":"parsing-error","errorCode":null,"errorMessage":"Parsing error","messagePattern":"Parsing error","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java","lineNumber":215,"sourceCode":"\t\t\t\tif (address.equals(\"127.0.0.1/32\")) {\t// IPv4 localhost\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (address.equals(\"::1/128\")) {\t\t// IPv6 localhost\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Parse the fields out of a line of the connection file\n\t\t * @param line the text to parse\n\t\t * @throws IOException if the text is not formatted properly to parse\n\t\t */\n\t\tpublic void parse(String line) throws IOException {\n\t\t\tString[] split = line.split(\" +\");\t\t// Split on whitespace\n\t\t\tif (split.length < 4) {\n\t\t\t\tthrow new IOException(\"Parsing error\");\n\t\t\t}\n\t\t\ttype = split[0];\n\t\t\tdatabase = split[1];\n\t\t\tuser = split[2];\n\t\t\tint nextPos = 3;\n\t\t\tif (type.equals(\"local\")) {\t\t// \"local\" type has no address\n\t\t\t\taddress = null;\n\t\t\t}\n\t\t\telse {\n\t\t\t\taddress = split[3];\n\t\t\t\tnextPos = 4;\n\t\t\t}\n\t\t\tif (nextPos >= split.length) {\n\t\t\t\tthrow new IOException(\"Parsing error\");\n\t\t\t}\n\t\t\tmethod = split[nextPos];\n\t\t\tnextPos += 1;\n\t\t\tif (nextPos >= split.length) {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java#L197-L233","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the connection config file and find the offending line: ensure it has at least 4 whitespace-separated fields (type database user [address] method).","For non-local types the line needs 5 fields (with an address); for 'local' type it needs at least 4.","Prefix genuine comments with '#' so they are not parsed as entries.","Remove stray blank or partial lines."],"exampleFix":"// before (config file line)\nlocal   all   all\n// after\nlocal   all   all   md5","handlingStrategy":"validation","validationCode":"// Validate a connection config line before handing it to parse\nString[] split = line.trim().split(\" +\");\nboolean isLocal = split.length > 0 && split[0].equals(\"local\");\nint minFields = isLocal ? 4 : 5;\nif (split.length < 4) {\n    throw new IllegalArgumentException(\n        \"Connection config line has too few fields (need >= 4): \" + line);\n}\nentry.parse(line);","typeGuard":null,"tryCatchPattern":"try {\n    entry.parse(line);\n} catch (IOException e) {\n    if (e.getMessage().equals(\"Parsing error\")) {\n        log.error(\"Malformed connection config line: '{}'\", line);\n    }\n    throw e;\n}","preventionTips":["Lint the connection config file: each non-comment line needs type database user [address] method.","Prefix comments with '#' and remove stray partial lines.","Validate field counts per type (local=4+, host=5+) before parsing."],"tags":["bsim","server-config","config-parsing","postgresql"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}