{"record":{"id":"17582e2436eb5c5f","repo":"redis/jedis","slug":"name-must-not-be-null","errorCode":null,"errorMessage":"Name must not be null","messagePattern":"Name must not be null","errorType":"validation","errorClass":"JedisValidationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/DriverInfo.java","lineNumber":150,"sourceCode":"    }\n\n    private Builder(DriverInfo driverInfo) {\n      this.name = driverInfo.name;\n      this.upstreamDrivers = new ArrayList<>(driverInfo.upstreamDrivers);\n    }\n\n    /**\n     * Sets the base library name.\n     * <p>\n     * This overrides the default name (\"Jedis\"). Use this when you want to completely customize the\n     * library identification.\n     * @param name the library name, must not be {@code null}\n     * @return this builder\n     * @throws JedisValidationException if name is {@code null}\n     */\n    public Builder name(String name) {\n      if (name == null) {\n        throw new JedisValidationException(\"Name must not be null\");\n      }\n      this.name = name;\n      return this;\n    }\n\n    /**\n     * Adds an upstream driver to the driver information.\n     * <p>\n     * Upstream drivers are prepended to the list, so the most recently added driver appears first\n     * in the formatted output.\n     * <p>\n     * The driver name must follow Maven artifactId naming conventions: lowercase letters, digits,\n     * hyphens, and underscores only, starting with a lowercase letter. Dots are only allowed after\n     * digits (for Scala cross-version naming like akka-redis_2.13).\n     * <p>\n     * Both values must not contain spaces, newlines, non-printable characters, or brace characters\n     * as these would violate the format of the Redis CLIENT LIST reply.\n     * @param driverName the name of the upstream driver (e.g., \"spring-data-redis\"), must not be","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/DriverInfo.java#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-null literal or resolved string to name(), e.g. name(\"my-app\").","If the name is derived, default it: use a fallback constant when the lookup returns null.","Check where the name string originates (config key, manifest, env) and ensure it is populated.","Validate the name earlier at the wrapper's own API boundary with Objects.requireNonNull and a descriptive message."],"exampleFix":"// before\nString libName = System.getProperty(\"app.lib.name\");\nDriverInfo.builder().name(libName).build(); // NPE-ish: libName may be null\n\n// after\nString libName = System.getProperty(\"app.lib.name\", \"my-application\");\nDriverInfo.builder().name(libName).build();","handlingStrategy":"validation","validationCode":"if (libName == null || libName.isEmpty()) {\n  libName = \"unknown-application\";\n}\nDriverInfo.builder().name(libName);","typeGuard":"static boolean isNonNullName(String s) {\n  return s != null;\n}","tryCatchPattern":"try {\n  driverBuilder.name(libName);\n} catch (JedisValidationException e) {\n  driverBuilder.name(\"default-lib-name\");\n}","preventionTips":["Never pass user/config-derived strings to name() without a null check or default.","Store the library name as a compile-time constant where possible to eliminate null paths.","If the name is looked up (manifest/system property/config), supply a fallback at lookup time.","Unit-test the DriverInfo construction path of your wrapper library."],"tags":["validation","null","driver-info","client-setinfo"],"backgroundTag":"null-argument","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}