redis/jedis · error · JedisValidationException

Name must not be null

Error message

Name must not be null

What it means

The DriverInfo.Builder.name(String) setter validates that the library name is non-null before storing it, throwing JedisValidationException('Name must not be null') otherwise. DriverInfo is used for CLIENT SETINFO lib-name reporting to the Redis server, which requires a name. Jedis fails fast at build time rather than sending an invalid value to the server.

Solutions

  1. Pass a non-null literal or resolved string to name(), e.g. name("my-app").
  2. If the name is derived, default it: use a fallback constant when the lookup returns null.
  3. Check where the name string originates (config key, manifest, env) and ensure it is populated.
  4. Validate the name earlier at the wrapper's own API boundary with Objects.requireNonNull and a descriptive message.

Example fix

// before
String libName = System.getProperty("app.lib.name");
DriverInfo.builder().name(libName).build(); // NPE-ish: libName may be null

// after
String libName = System.getProperty("app.lib.name", "my-application");
DriverInfo.builder().name(libName).build();
Defensive patterns

Strategy: validation

Validate before calling

if (libName == null || libName.isEmpty()) {
  libName = "unknown-application";
}
DriverInfo.builder().name(libName);

Type guard

static boolean isNonNullName(String s) {
  return s != null;
}

Try / catch

try {
  driverBuilder.name(libName);
} catch (JedisValidationException e) {
  driverBuilder.name("default-lib-name");
}

Prevention

When it happens

Trigger: Calling DriverInfo.builder().name(null) — often when the name comes from a null-returning source: a system property, manifest attribute, configuration key, or method parameter that was never set.

Common situations: Application instrumentation code deriving the library name from a config/manifest that is missing; frameworks wrapping Jedis passing through an unset metadata field; refactors that made a formerly constant name a nullable lookup.

Related errors


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

Appendix: source

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

    }

    private Builder(DriverInfo driverInfo) {
      this.name = driverInfo.name;
      this.upstreamDrivers = new ArrayList<>(driverInfo.upstreamDrivers);
    }

    /**
     * Sets the base library name.
     * <p>
     * This overrides the default name ("Jedis"). Use this when you want to completely customize the
     * library identification.
     * @param name the library name, must not be {@code null}
     * @return this builder
     * @throws JedisValidationException if name is {@code null}
     */
    public Builder name(String name) {
      if (name == null) {
        throw new JedisValidationException("Name must not be null");
      }
      this.name = name;
      return this;
    }

    /**
     * Adds an upstream driver to the driver information.
     * <p>
     * Upstream drivers are prepended to the list, so the most recently added driver appears first
     * in the formatted output.
     * <p>
     * The driver name must follow Maven artifactId naming conventions: lowercase letters, digits,
     * 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

View on GitHub (pinned to 6dac31d4c2)