redis/jedis · error · JedisValidationException

Endpoint must not be null

Error message

Endpoint must not be null

What it means

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.

Solutions

  1. Null-check the endpoint before calling remove().
  2. Filter null entries out of the endpoint collection before iterating removals.
  3. Ensure endpoint resolution logic never yields null; fail earlier with a clear message.

Example fix

// before
provider.remove(endpoint); // endpoint may be null

// after
if (endpoint != null) provider.remove(endpoint);
Defensive patterns

Strategy: type-guard

Validate before calling

if (endpoint == null) return; // or throw earlier with clear context

Type guard

boolean isRemovable(Endpoint e) { return e != null; }

Try / catch

try {
  provider.remove(endpoint);
} catch (JedisValidationException e) {
  log.warn("Skipping removal: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling provider.remove(null) — e.g. an endpoint variable that failed resolution or was never initialized.

Common situations: Shutdown/cleanup code removing endpoints from a list where some entries are null; propagating an unresolved endpoint value into remove().

Related errors


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/c06d9e0fd90c6397. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/mcf/MultiDbConnectionProvider.java:262

    }

    activeDatabaseChangeLock.lock();
    try {
      addDatabaseInternal(multiDbConfig, databaseConfig);
    } finally {
      activeDatabaseChangeLock.unlock();
    }
  }

  /**
   * Removes a database endpoint from the provider.
   * @param endpoint the endpoint to remove
   * @throws JedisValidationException if the endpoint doesn't exist or is the last remaining
   *           endpoint
   */
  public void remove(Endpoint endpoint) {
    if (endpoint == null) {
      throw new JedisValidationException("Endpoint must not be null");
    }

    if (!databaseMap.containsKey(endpoint)) {
      throw new JedisValidationException(
          "Endpoint " + endpoint + " does not exist in the provider");
    }

    if (databaseMap.size() < 2) {
      throw new JedisValidationException("Cannot remove the last remaining endpoint");
    }
    log.debug("Removing endpoint {}", endpoint);

    Map.Entry<Endpoint, Database> notificationData = null;
    activeDatabaseChangeLock.lock();
    try {
      Database databaseToRemove = databaseMap.get(endpoint);
      boolean isActiveDatabase = (activeDatabase == databaseToRemove);

View on GitHub (pinned to 6dac31d4c2)