{"record":{"id":"c06d9e0fd90c6397","repo":"redis/jedis","slug":"endpoint-must-not-be-null","errorCode":null,"errorMessage":"Endpoint must not be null","messagePattern":"Endpoint must not be null","errorType":"validation","errorClass":"JedisValidationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/mcf/MultiDbConnectionProvider.java","lineNumber":262,"sourceCode":"    }\n\n    activeDatabaseChangeLock.lock();\n    try {\n      addDatabaseInternal(multiDbConfig, databaseConfig);\n    } finally {\n      activeDatabaseChangeLock.unlock();\n    }\n  }\n\n  /**\n   * Removes a database endpoint from the provider.\n   * @param endpoint the endpoint to remove\n   * @throws JedisValidationException if the endpoint doesn't exist or is the last remaining\n   *           endpoint\n   */\n  public void remove(Endpoint endpoint) {\n    if (endpoint == null) {\n      throw new JedisValidationException(\"Endpoint must not be null\");\n    }\n\n    if (!databaseMap.containsKey(endpoint)) {\n      throw new JedisValidationException(\n          \"Endpoint \" + endpoint + \" does not exist in the provider\");\n    }\n\n    if (databaseMap.size() < 2) {\n      throw new JedisValidationException(\"Cannot remove the last remaining endpoint\");\n    }\n    log.debug(\"Removing endpoint {}\", endpoint);\n\n    Map.Entry<Endpoint, Database> notificationData = null;\n    activeDatabaseChangeLock.lock();\n    try {\n      Database databaseToRemove = databaseMap.get(endpoint);\n      boolean isActiveDatabase = (activeDatabase == databaseToRemove);\n","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/mcf/MultiDbConnectionProvider.java#L244-L280","documentation":"Validation guard at the top of MultiDbConnectionProvider.remove(): the endpoint argument is null, so there is no database entry to remove from the multi-db failover map. The provider requires a concrete, registered Endpoint to perform removal under the active-database lock.","triggerScenarios":"Calling provider.remove(null) — e.g. an endpoint variable that failed resolution or was never initialized.","commonSituations":"Shutdown/cleanup code removing endpoints from a list where some entries are null; propagating an unresolved endpoint value into remove().","solutions":["Null-check the endpoint before calling remove().","Filter null entries out of the endpoint collection before iterating removals.","Ensure endpoint resolution logic never yields null; fail earlier with a clear message."],"exampleFix":"// before\nprovider.remove(endpoint); // endpoint may be null\n\n// after\nif (endpoint != null) provider.remove(endpoint);","handlingStrategy":"type-guard","validationCode":"if (endpoint == null) return; // or throw earlier with clear context","typeGuard":"boolean isRemovable(Endpoint e) { return e != null; }","tryCatchPattern":"try {\n  provider.remove(endpoint);\n} catch (JedisValidationException e) {\n  log.warn(\"Skipping removal: {}\", e.getMessage());\n}","preventionTips":["Null-check endpoints resolved from external sources before calling remove().","Use Optional<Endpoint> for endpoint resolution results.","Filter nulls from endpoint collections before batch removal."],"tags":["validation","null-check","multi-db"],"backgroundTag":"null-argument","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}