redis/jedis · error · JedisValidationException

MultiDbConfig must not be NULL for MultiDbConnectionProvider

Error message

MultiDbConfig must not be NULL for MultiDbConnectionProvider

What it means

MultiDbConnectionProvider's cache-aware constructor validates that a non-null MultiDbConfig is supplied; a null config would leave the provider without any database definitions. A JedisValidationException is thrown immediately during construction.

Solutions

  1. Build a MultiDbConfig via MultiDbConfig.builder(endpoint)...build() before constructing the provider.
  2. Add a null check on your config construction code path to catch the mistake before instantiating the provider.
  3. If using DI, verify the config bean is actually bound/registered.

Example fix

// before
MultiDbConnectionProvider provider = new MultiDbConnectionProvider(null, cache);

// after
MultiDbConfig cfg = MultiDbConfig.builder(endpoint).build();
MultiDbConnectionProvider provider = new MultiDbConnectionProvider(cfg, cache);
Defensive patterns

Strategy: validation

Validate before calling

if (multiDbConfig == null) {
  throw new IllegalStateException("multiDbConfig must be built before creating provider");
}

Prevention

When it happens

Trigger: Instantiating new MultiDbConnectionProvider(null, cache) — passing a null MultiDbConfig while supplying a client-side Cache.

Common situations: Programmatic construction where the config is built conditionally and ends up null; DI frameworks injecting a missing config bean; typos in variable names passing null.

Related errors


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

Appendix: source

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

  private final Cache cache;

  /**
   * Constructor for MultiDbConnectionProvider. For the case where client side cache is not used.
   * Check other constructor where client side cache is demanded.
   * @param multiDbConfig the multi-database configuration
   */
  public MultiDbConnectionProvider(MultiDbConfig multiDbConfig) {
    this(multiDbConfig, null);
  }

  /**
   * Constructor for MultiDbConnectionProvider. For the case where client side cache is used.
   * @param multiDbConfig the multi-database configuration
   * @param cache the client-side cache
   */
  public MultiDbConnectionProvider(MultiDbConfig multiDbConfig, Cache cache) {

    if (multiDbConfig == null) throw new JedisValidationException(
        "MultiDbConfig must not be NULL for MultiDbConnectionProvider");

    this.multiDbConfig = multiDbConfig;
    this.cache = cache;

    ////////////// Configure Retry ////////////////////
    MultiDbConfig.RetryConfig commandRetry = multiDbConfig.getCommandRetry();
    this.retryConfig = buildRetryConfig(commandRetry);

    ////////////// Configure Circuit Breaker ////////////////////
    MultiDbConfig.CircuitBreakerConfig failureDetector = multiDbConfig.getFailureDetector();
    this.circuitBreakerConfig = buildCircuitBreakerConfig(failureDetector, multiDbConfig);

    ////////////// Configure Database Map ////////////////////
    DatabaseConfig[] databaseConfigs = multiDbConfig.getDatabaseConfigs();

    // Now add databases - health checks will start but events will be queued
    for (DatabaseConfig config : databaseConfigs) {

View on GitHub (pinned to 6dac31d4c2)