{"record":{"id":"cc327862a9191de4","repo":"apache/druid","slug":"user-s-does-not-exist-cc3278","errorCode":null,"errorMessage":"User [%s] does not exist.","messagePattern":"User \\[(.+?)\\] does not exist\\.","errorType":"http","errorClass":"BasicSecurityDBResourceException","httpStatus":400,"severity":"warning","filePath":"extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/endpoint/CoordinatorBasicAuthenticatorResourceHandler.java","lineNumber":103,"sourceCode":"  }\n\n  @Override\n  public Response getUser(String authenticatorName, String userName)\n  {\n    final BasicHTTPAuthenticator authenticator = authenticatorMap.get(authenticatorName);\n    if (authenticator == null) {\n      return makeResponseForAuthenticatorNotFound(authenticatorName);\n    }\n\n    Map<String, BasicAuthenticatorUser> userMap = BasicAuthUtils.deserializeAuthenticatorUserMap(\n        objectMapper,\n        storageUpdater.getCurrentUserMapBytes(authenticatorName)\n    );\n\n    try {\n      BasicAuthenticatorUser user = userMap.get(userName);\n      if (user == null) {\n        throw new BasicSecurityDBResourceException(\"User [%s] does not exist.\", userName);\n      }\n      return Response.ok(user).build();\n    }\n    catch (BasicSecurityDBResourceException cfe) {\n      return makeResponseForBasicSecurityDBResourceException(cfe);\n    }\n  }\n\n  @Override\n  public Response createUser(String authenticatorName, String userName)\n  {\n    final BasicHTTPAuthenticator authenticator = authenticatorMap.get(authenticatorName);\n    if (authenticator == null) {\n      return makeResponseForAuthenticatorNotFound(authenticatorName);\n    }\n\n    try {\n      storageUpdater.createUser(authenticatorName, userName);","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/endpoint/CoordinatorBasicAuthenticatorResourceHandler.java#L85-L121","documentation":"Thrown as BasicSecurityDBResourceException by the coordinator's getUser endpoint when the requested user is absent from the authenticator user map. The handler catches it and converts it into an HTTP error response. It is the standard 'unknown user' signal for the basic-security authentication user API.","triggerScenarios":"GET /druid-ext/basic-security/authentication/<authenticator>/users/<userName> for a userName that does not exist in the stored user map.","commonSituations":"Typo in the userName or authenticator name; querying users on a newly created authenticator with no users; user removed by a concurrent deletion; automation reading a user before the create completed.","solutions":["List users (GET .../users) to confirm the exact userName before fetching","Verify the authenticator name matches your druid.auth.authenticators config","Handle the 404-style response in clients rather than assuming the user exists","Re-create the user if it was deleted unintentionally"],"exampleFix":"// before\nResponse r = client.getUser(authenticatorName, userName); // may be error response\nUser u = r.readEntity(User.class);\n// after\nResponse r = client.getUser(authenticatorName, userName);\nif (r.getStatus() == 404) { /* user absent: create or skip */ } else { User u = r.readEntity(User.class); }","handlingStrategy":"try-catch","validationCode":"// list users first to validate the userName\nString users = client.getUsers(authenticatorName).readEntity(String.class);\nboolean exists = users.contains(\"\\\"\" + userName + \"\\\"\");","typeGuard":null,"tryCatchPattern":"try {\n  Response r = client.getUser(authenticatorName, userName);\n  User u = r.readEntity(User.class);\n} catch (WebApplicationException e) {\n  if (e.getResponse().getStatus() == 404) { /* user absent: create or skip */ } else throw e;\n}","preventionTips":["Validate userName/authenticator names against the config before API calls","Handle 404-style responses in automation instead of assuming existence","Re-check existence after any concurrent user-management operation"],"tags":["resource-not-found","basic-security","rest-api"],"backgroundTag":"user-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}