redis/jedis · error · JedisValidationException

DriverInfo must not be null

Error message

DriverInfo must not be null

What it means

ClientSetInfoConfig is used with CLIENT SETINFO to attach driver/library metadata to a Redis connection. The constructor validates its argument and throws JedisValidationException when driverInfo is null, because a config with neither driverInfo nor a meaningful value would produce invalid CLIENT SETINFO arguments.

Solutions

  1. Construct a DriverInfo before building the config, e.g. `new ClientSetInfoConfig(new DriverInfo("my-lib", "1.0.0"))`
  2. Null-check the DriverInfo value at the call site before creating ClientSetInfoConfig
  3. If driver info is optional in your flow, guard with `driverInfo == null ? default : new ClientSetInfoConfig(driverInfo)`

Example fix

// before
DriverInfo info = loadDriverInfo(); // may return null
ClientSetInfoConfig cfg = new ClientSetInfoConfig(info);
// after
DriverInfo info = loadDriverInfo();
ClientSetInfoConfig cfg = info != null ? new ClientSetInfoConfig(info) : null;
Defensive patterns

Strategy: validation

Validate before calling

if (driverInfo == null) throw new IllegalArgumentException("driverInfo must be set before creating ClientSetInfoConfig");

Type guard

static boolean hasDriverInfo(DriverInfo d) { return d != null; }

Try / catch

try { new ClientSetInfoConfig(driverInfo); } catch (JedisValidationException e) { logger.error("ClientSetInfoConfig requires non-null DriverInfo", e); driverInfo = new DriverInfo("default", "0"); }

Prevention

When it happens

Trigger: Calling `new ClientSetInfoConfig(null)` directly, or passing a DriverInfo variable that was never initialized (or returned null from a factory/lookup) into the constructor or into ClientSetInfoConfig.builder().driverInfo(null).

Common situations: Building connection configuration where DriverInfo is loaded conditionally (e.g. from properties) and a missing property yields null; refactoring code that previously passed a library-name string and now passes a DriverInfo object.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/ClientSetInfoConfig.java:74

   * @param libNameSuffix the suffix to append to "jedis" (will be placed in parentheses)
   * @throws JedisValidationException if libNameSuffix contains braces
   */
  public ClientSetInfoConfig(String libNameSuffix) {
    this.disabled = false;
    this.driverInfo = DriverInfo.builder().addUpstreamDriver(libNameSuffix).build();
  }

  /**
   * Creates a new ClientSetInfoConfig with the specified driver information.
   * <p>
   * This is the recommended constructor for setting up driver information with upstream drivers.
   * The driver information can optionally override the library name completely.
   * @param driverInfo the driver information, must not be {@code null}
   * @throws JedisValidationException if driverInfo is {@code null}
   */
  public ClientSetInfoConfig(DriverInfo driverInfo) {
    if (driverInfo == null) {
      throw new JedisValidationException("DriverInfo must not be null");
    }
    this.disabled = false;
    this.driverInfo = driverInfo;
  }

  /**
   * @return {@code true} if CLIENT SETINFO is disabled, {@code false} otherwise
   */
  public boolean isDisabled() {
    return disabled;
  }

  /**
   * @return the driver information
   */
  public DriverInfo getDriverInfo() {
    return driverInfo;
  }

View on GitHub (pinned to 6dac31d4c2)