diff --git a/src/main/java/redis/clients/jedis/Connection.java b/src/main/java/redis/clients/jedis/Connection.java index c8380e1051..4eb40655b8 100644 --- a/src/main/java/redis/clients/jedis/Connection.java +++ b/src/main/java/redis/clients/jedis/Connection.java @@ -398,7 +398,14 @@ private void initializeFromClientConfig(JedisClientConfig config) { if (obj instanceof JedisDataException) { JedisDataException e = (JedisDataException)obj; String errorMsg = e.getMessage().toUpperCase(); - if (errorMsg.contains("UNKNOWN") || + /** + * 1. Redis 4.0 and before, we need to ignore `Syntax error`. + * 2. Redis 5.0 and later, we need to ignore `Unknown subcommand error`. + * 3. Because Jedis allows Jedis jedis = new Jedis() in advance, and jedis.auth(password) later, + * we need to ignore `NOAUTH errors`. + */ + if (errorMsg.contains("SYNTAX") || + errorMsg.contains("UNKNOWN") || errorMsg.contains("NOAUTH")) { // TODO: not filter out NOAUTH // ignore } else {