redis/jedis · error · JedisValidationException
Driver name must not be null
Error message
Driver name must not be null
What it means
DriverInfo.Builder.addUpstreamDriver(String driverName, String driverVersion) registers an upstream driver for CLIENT SETINFO reporting and rejects a null driverName with JedisValidationException('Driver name must not be null'). Non-null values are further checked by validateDriverField (format/naming rules), so both name and version must be valid, non-empty, well-formed strings.
Solutions
- Pass non-null, non-empty literals or resolved values for both driverName and driverVersion, e.g. addUpstreamDriver("lettuce-core", "6.3.0").
- Default null lookups before the call: use a fallback name/version when metadata is unavailable.
- Check the metadata source (manifest, package info, config) that should supply the driver name/version.
- Validate upstream values at the caller's boundary with Objects.requireNonNull to get a clearer stack trace.
- Review validateDriverField rules and ensure the values satisfy the naming conventions before calling.
Example fix
// before
String driver = detectDriver(); // may return null
info.addUpstreamDriver(driver, version);
// after
String driver = detectDriver();
if (driver != null) {
info.addUpstreamDriver(driver, version != null ? version : "unknown");
} Defensive patterns
Strategy: validation
Validate before calling
if (driverName != null && driverVersion != null) {
driverBuilder.addUpstreamDriver(driverName, driverVersion);
} Type guard
static boolean isValidDriverPair(String name, String version) {
return name != null && version != null;
} Try / catch
try {
driverBuilder.addUpstreamDriver(name, version);
} catch (JedisValidationException e) {
// skip upstream-driver registration or use non-null defaults
driverBuilder.addUpstreamDriver(name != null ? name : "unknown", version != null ? version : "unknown");
} Prevention
- Check both driverName and driverVersion for null before calling addUpstreamDriver; each has its own null guard.
- Provide fallback values (e.g. "unknown") for driver metadata discovered dynamically from manifests or config.
- Keep argument order (name, version) in mind — swapped arguments can trip the format validation in validateDriverField.
- Centralize upstream-driver registration in one helper that performs the null checks once.
- Cover the metadata-discovery path with tests simulating missing metadata.
When it happens
Trigger: Calling addUpstreamDriver(null, ...) with a driver name obtained from a null-returning lookup (package metadata, DI bean, config); a null check on driverVersion similarly throws 'Driver version must not be null'; values that are non-null but malformed fail validateDriverField.
Common situations: Middleware/frameworks (e.g. Spring Data Redis wrappers) registering the underlying driver and passing through an unresolved metadata field; dynamic discovery of driver version from a manifest that is absent; copy-paste where arguments are swapped or one is left null.
Related errors
- Name must not be null
- DriverInfo must not be null
- DriverInfo must not be null
- Driver version must not be null
- must not be empty
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/3f0ae6f263294b7e.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/DriverInfo.java:181
* hyphens, and underscores only, starting with a lowercase letter. Dots are only allowed after
* digits (for Scala cross-version naming like akka-redis_2.13).
* <p>
* 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)