redis/jedis · error · JedisValidationException

Driver version must not be null

Error message

Driver version must not be null

What it means

DriverInfo.Builder.addUpstreamDriver(String, String) throws JedisValidationException when the driverVersion argument is null. Jedis builds a CLIENT SETINFO lib-name/lib-ver payload, so every upstream driver entry must have a non-null, non-empty version. The check runs before character validation, so null is rejected first.

Solutions

  1. Pass a concrete non-null version string to addUpstreamDriver(name, version).
  2. If the version may be absent, skip the call or substitute a fallback like "unknown" instead of null.
  3. Use JedisValidationException handling if driver registration is best-effort and should not abort startup.

Example fix

// before
DriverInfo.builder().addUpstreamDriver("spring-data-redis", props.getProperty("sdr.version")); // may be null
// after
String v = props.getProperty("sdr.version", "unknown");
DriverInfo.builder().addUpstreamDriver("spring-data-redis", v);
Defensive patterns

Strategy: validation

Validate before calling

if (driverVersion == null || driverVersion.trim().isEmpty()) {
  throw new IllegalStateException("Upstream driver version must be provided");
}

Type guard

boolean hasVersion(String v) { return v != null && !v.trim().isEmpty(); }

Try / catch

try {
  DriverInfo.builder().addUpstreamDriver(name, version);
} catch (JedisValidationException e) {
  log.warn("Driver registration skipped: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling builder.addUpstreamDriver("my-driver", null) on DriverInfo.Builder; passing a version field that was never initialized (e.g. read from a manifest or system property that is absent) into addUpstreamDriver.

Common situations: Wrapping frameworks register themselves as upstream drivers and read version from package metadata or a properties resource that is missing; refactoring code where the version constant was removed or renamed; building DriverInfo in generated/templated code where the version placeholder resolves to null.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/DriverInfo.java:184

     * Both values must not contain spaces, newlines, non-printable characters, or brace characters
     * as these would violate the format of the Redis CLIENT LIST reply.
     * @param driverName the name of the upstream driver (e.g., "spring-data-redis"), must not be
     *          {@code null}
     * @param driverVersion the version of the upstream driver (e.g., "3.2.0"), must not be
     *          {@code null}
     * @return this builder
     * @throws JedisValidationException if the driver name or version is {@code null} or has invalid
     *           format
     * @see <a href="https://maven.apache.org/guides/mini/guide-naming-conventions.html">Maven
     *      Naming Conventions</a>
     * @see <a href="https://redis.io/docs/latest/commands/client-setinfo/">CLIENT SETINFO</a>
     */
    public Builder addUpstreamDriver(String driverName, String driverVersion) {
      if (driverName == null) {
        throw new JedisValidationException("Driver name must not be null");
      }
      if (driverVersion == null) {
        throw new JedisValidationException("Driver version must not be null");
      }
      validateDriverField(driverName, "Driver name");
      validateDriverField(driverVersion, "Driver version");
      String formattedDriverInfo = formatDriverInfo(driverName, driverVersion);
      this.upstreamDrivers.add(0, formattedDriverInfo);
      return this;
    }

    public Builder addUpstreamDriver(String driverName) {
      if (driverName == null) {
        throw new JedisValidationException("Driver name must not be null");
      }
      validateDriverField(driverName, "Driver name");
      this.upstreamDrivers.add(0, driverName);
      return this;
    }

    /**

View on GitHub (pinned to 6dac31d4c2)