{"record":{"id":"5be96ffb71135ff6","repo":"NationalSecurityAgency/ghidra","slug":"error-creating-new-user","errorCode":null,"errorMessage":"Error creating new user","messagePattern":"Error creating new user","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":1109,"sourceCode":"\t\t}\n\t}\n\n\t/**\n\t * Trigger a server running on the local host to rescan its identity file to pickup\n\t * any changes to the user mapping\n\t * @throws IOException if creating a new user fails\n\t * @throws InterruptedException if the reload command is interrupted\n\t */\n\tprivate void reloadIdent() throws IOException, InterruptedException {\n\t\tList<String> command = new ArrayList<String>();\n\t\tcommand.add(postgresControl.getAbsolutePath());\n\t\tcommand.add(\"reload\");\n\t\tcommand.add(\"-D\");\n\t\tcommand.add(dataDirectory.getAbsolutePath());\n\t\tcommand.add(\"-s\");\n\t\tint res = runCommand(null, command, loadLibraryVar, loadLibraryValue);\n\t\tif (res != 0) {\n\t\t\tthrow new IOException(\"Error creating new user\");\n\t\t}\n\t}\n\n\t/**\n\t * Update the PostgreSQL identity map (pg_ident.conf) adding a map from\n\t * the currently active -commonName- to -username-\n\t * @param username the user name to add\n\t * @throws IOException if the postgres ident file is invalid\n\t */\n\tprivate void addCertificateName(String username) throws IOException {\n\t\tFile identFile = new File(dataDirectory, POSTGRES_IDENTFILE);\n\t\tFile copyFile = new File(dataDirectory, POSTGRES_IDENTFILE + \".copy\");\n\t\tif (!identFile.isFile()) {\n\t\t\tthrow new IOException(\"Missing ident file: \" + identFile.getAbsolutePath());\n\t\t}\n\t\tServerConfig.patchIdent(identFile, copyFile, POSTGRES_MAP_IDENTIFIER, commonName, username,\n\t\t\ttrue);\n\t\tFileUtilities.copyFile(copyFile, identFile, false, null);","sourceCodeStart":1091,"sourceCodeEnd":1127,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L1091-L1127","documentation":"Thrown by reloadIdent() when `pg_ctl reload -s` returns non-zero after BSim patches pg_ident.conf. The reload tells PostgreSQL to re-read its identity map; failure means the new certificate-to-user mapping was not picked up.","triggerScenarios":"During addCertificateName (init flow) or the drop-user ident patch, after editing pg_ident.conf, `pg_ctl reload -D <dataDir> -s` exits non-zero.","commonSituations":"Server not running when reload is attempted; malformed pg_ident.conf edit; permissions on the data directory; postgres process owned by a different user.","solutions":["Ensure the server is running before adding/dropping users: `bsim_ctl status`.","Inspect pg_ident.conf for syntax errors introduced by patchIdent.","Run bsim_ctl as the data-directory owner.","Retry the adduser/dropuser once the server is confirmed up."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure server is up before a user op that triggers reloadIdent.\nint rc = runPgCtl(\"status\", dataDir);\nif (rc != 0) {\n    throw new IllegalStateException(\"Server not running; cannot reload pg_ident.conf\");\n}","typeGuard":"public boolean identFilePatchable(File dir) {\n    File f = new File(dir, \"pg_ident.conf\");\n    return f.isFile() && f.canRead() && f.canWrite();\n}","tryCatchPattern":"try {\n    bsimControl.adduser(args);\n} catch (IOException e) {\n    if (\"Error creating new user\".equals(e.getMessage())) {\n        throw new UserFacingException(\"pg_ctl reload failed; is the server running and pg_ident.conf valid?\", e);\n    }\n    throw e;\n}","preventionTips":["Confirm the server is running before add/drop user.","Never hand-edit pg_ident.conf in a way that breaks patchIdent's assumptions.","Retry the user op after restoring server availability."],"tags":["postgresql","authentication","pki","process","bsim","cli"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}