redis/jedis · error · UnsupportedOperationException

Endpoint and credentials are required to build…

Error message

Endpoint and credentials are required to build LagAwareStrategy.Config.

What it means

LagAwareStrategy.Config.builder() with no arguments is intentionally unsupported: an UnsupportedOperationException is thrown because building a lag-aware health-check config requires an Endpoint and a credentials supplier. Developers must use the overload Config.builder(Endpoint, Supplier) instead.

Solutions

  1. Call LagAwareStrategy.Config.builder(endpoint, credentialsSupplier) with the target Endpoint and a Supplier supplying credentials.
  2. Update code that used the no-arg builder to pass the endpoint and credential supplier explicitly.

Example fix

// before
LagAwareStrategy.Config.ConfigBuilder b = LagAwareStrategy.Config.builder();

// after
LagAwareStrategy.Config cfg = LagAwareStrategy.Config.builder(endpoint,
    () -> new DefaultJedisClientConfig.Builder().password(pass).build()).build();
Defensive patterns

Strategy: validation

Validate before calling

// ensure you always use the two-arg builder
LagAwareStrategy.Config cfg = LagAwareStrategy.Config.builder(endpoint, credsSupplier).build();

Prevention

When it happens

Trigger: Calling the static LagAwareStrategy.Config.builder() zero-argument overload at any time — the method body unconditionally throws.

Common situations: Copy-pasting the generic HealthCheckStrategy.Config.builder() pattern; IDE autocomplete picking the no-arg overload; migrating code from a plain health check config to LagAwareStrategy.Config.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/mcf/LagAwareStrategy.java:165

    }

    /**
     * Create a new builder for LagAwareStrategy.Config.
     * @param restEndpoint the Redis Enterprise REST API endpoint
     * @param credentialsSupplier the credentials supplier
     * @return a new ConfigBuilder instance
     */
    public static ConfigBuilder builder(Endpoint restEndpoint,
        Supplier<RedisCredentials> credentialsSupplier) {
      return new ConfigBuilder(restEndpoint, credentialsSupplier);
    }

    /**
     * Use {@link LagAwareStrategy.Config#builder(Endpoint, Supplier)} instead.
     * @return a new Builder instance
     */
    public static ConfigBuilder builder() {
      throw new UnsupportedOperationException(
          "Endpoint and credentials are required to build LagAwareStrategy.Config.");
    }

    /**
     * Create a new Config instance with default values.
     * <p>
     * Extended checks like lag validation is enabled by default. With a default lag tolerance of
     * 100ms. To perform only standard datapath validation, use
     * {@link #databaseAvailability(Endpoint, Supplier)}. To configure a custom lag tolerance, use
     * {@link #lagAwareWithTolerance(Endpoint, Supplier, Duration)}
     * </p>
     */
    public static Config create(Endpoint restEndpoint,
        Supplier<RedisCredentials> credentialsSupplier) {
      return new ConfigBuilder(restEndpoint, credentialsSupplier).build();
    }

    /**

View on GitHub (pinned to 6dac31d4c2)