redis/jedis · error · JedisValidationException
Provided endpoint is null. Please use one from the…
Error message
Provided endpoint is null. Please use one from the configuration
What it means
MultiDbConnectionProvider.setActiveDatabase() throws JedisValidationException when the Endpoint argument is null. The provider switches traffic between multiple Redis databases keyed by Endpoint objects, so a null endpoint has no meaning and would cause a NullPointerException later. The library fails fast with this explicit validation error instead.
Solutions
- Pass a non-null Endpoint obtained from the configured endpoints (e.g. from MultiDbConnectionProvider.getEndpoints() or your MultiDbConfig)
- Check for null before calling setActiveDatabase and log/throw a clearer application-level error
- Fix whatever produces the null endpoint: verify the configuration actually contains the endpoint and that field initialization/deserialization ran
- Catch JedisValidationException around the call as a last-resort guard
Example fix
// before
provider.setActiveDatabase(endpointFromConfig()); // may be null
// after
Endpoint endpoint = endpointFromConfig();
if (endpoint == null) {
throw new IllegalStateException("No endpoint configured for failover target");
}
provider.setActiveDatabase(endpoint); Defensive patterns
Strategy: validation
Validate before calling
if (endpoint == null) {
throw new IllegalArgumentException("endpoint must be one of " + provider.getEndpoints());
}
provider.setActiveDatabase(endpoint); Type guard
boolean isValidEndpoint(Endpoint e, MultiDbConnectionProvider p) {
return e != null && p.getEndpoints().contains(e);
} Try / catch
try {
provider.setActiveDatabase(endpoint);
} catch (JedisValidationException e) {
log.error("Null/invalid endpoint passed to setActiveDatabase: {}", e.getMessage());
} Prevention
- Source Endpoint objects from getEndpoints() or MultiDbConfig, never build them ad hoc
- Null-check configuration-derived values before failover logic runs
- Fail fast at application startup if no endpoints are configured
When it happens
Trigger: Calling setActiveDatabase(null) directly, or indirectly via forceActiveDatabase(null) or the cache-flushing database-switch flows (databaseSwitch_flushesClientSideCache / databaseSwitch_notFlushesClientSideCache) when an upstream variable holding the endpoint is null.
Common situations: A config property or map lookup for the endpoint returned null (e.g. MultiDbConfig not populated, wrong key), a deserialized endpoint field was never set, or a helper method returns Optional#get on an empty value.
Related errors
- Provided endpoint: is not within the configured endpoints…
- client info cannot contain spaces, newlines or special…
- protocol must not be null
- DriverInfo must not be null
- Driver version must not be null
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/9691c5afd4d19a12.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/mcf/MultiDbConnectionProvider.java:669
// event publishing
if (State.FORCED_OPEN.equals(originalState)) circuitBreaker.transitionToForcedOpenState();
throw new JedisValidationException(circuitBreaker.getName()
+ " failed to connect. Please check configuration and try again.", e);
}
}
/**
* Returns the set of all configured endpoints.
* @return the set of all configured endpoints
*/
public Set<Endpoint> getEndpoints() {
return new HashSet<>(databaseMap.keySet());
}
public void setActiveDatabase(Endpoint endpoint) {
if (endpoint == null) {
throw new JedisValidationException(
"Provided endpoint is null. Please use one from the configuration");
}
Database database = databaseMap.get(endpoint);
if (database == null) {
throw new JedisValidationException("Provided endpoint: " + endpoint + " is not within "
+ "the configured endpoints. Please use one from the configuration");
}
if (setActiveDatabase(database, true)) {
onDatabaseSwitch(SwitchReason.FORCED, endpoint, database);
}
}
public void forceActiveDatabase(Endpoint endpoint, long forcedActiveDuration) {
Database database = databaseMap.get(endpoint);
if (database == null) {
throw new JedisValidationException("Provided endpoint: " + endpoint + " is not within "
+ "the configured endpoints. Please use one from the configuration");View on GitHub (pinned to 6dac31d4c2)