redis/jedis · error · JedisValidationException

Endpoint does not exist in the provider

Error message

Endpoint ${endpoint} does not exist in the provider

What it means

remove(Endpoint) throws a JedisValidationException when the given endpoint is not present in the provider's databaseMap. You can only remove databases that were previously registered via the constructor config or add().

Solutions

  1. Verify the endpoint is registered before removing (keep your own set of added endpoints, or check the provider's state).
  2. Make removal idempotent: catch JedisValidationException and skip 'does not exist' cases.
  3. Confirm the Endpoint host/port exactly matches what was configured or added.

Example fix

// before
provider.remove(endpoint); // throws if not present

// after
try {
  provider.remove(endpoint);
} catch (JedisValidationException e) {
  // endpoint not registered; ignore
}
Defensive patterns

Strategy: validation

Validate before calling

// only remove endpoints you know you added
if (addedEndpoints.remove(endpoint)) {
  provider.remove(endpoint);
}

Try / catch

try {
  provider.remove(endpoint);
} catch (JedisValidationException e) {
  if (e.getMessage().contains("does not exist")) {
    // already removed; treat as idempotent
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling provider.remove(endpoint) with an endpoint that was never added, was already removed, or differs from the registered one (e.g. different port or hostname spelling).

Common situations: Double removal during shutdown; removing endpoints by string comparison where Endpoint instances don't match registered ones; stale references after a provider rebuild.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

      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);

      if (isActiveDatabase) {
        log.info("Active database is being removed. Finding a new active database...");
        Map.Entry<Endpoint, Database> candidate = findWeightedHealthyDatabaseToIterate(
          databaseToRemove);

View on GitHub (pinned to 6dac31d4c2)