PIKA trouble02 — (error) ERR Syntax error, try CLIENT (LIST [order by [addr|idle]| KILL ip:port)

  1. Problem description

Redis was originally used, but now Pika is used. Springboot version 2.1.8 is used. ClientName is configured inside. There is no problem when starting, but the following exception information will be reported when using:

org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool] with root cause

redis.clients.jedis.exceptions.JedisDataException: ERR Syntax error, try CLIENT (LIST [order by [addr|idle]| KILL ip:port)

    public RedisConnectionFactory connectionFactory(RedisProperties redisProperties) {

        JedisClientConfiguration clientConfig = JedisClientConfiguration.builder()

        RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisProperties.getHost());

        return new JedisConnectionFactory(configuration, clientConfig);

  2. Solution

After searching, it is caused by the ClientName field. Just remove the ClientName configuration. The problem is found as follows:

Call creation connection in class GenericObjectPool

private PooledObject<T> create() throws Exception {

        final PooledObject<T> p;
        try {
            p = factory.makeObject();
        } catch (final Throwable e) {
            throw e;
        } finally {
            synchronized (makeObjectCountLock) {

The client setname “zcx” command is called in the JedisFactory class, and an exception is thrown.

  public PooledObject<Jedis> makeObject() throws Exception {
    final HostAndPort hostAndPort = this.hostAndPort.get();
    final Jedis jedis = new Jedis(hostAndPort.getHost(), hostAndPort.getPort(), connectionTimeout,
        soTimeout, ssl, sslSocketFactory, sslParameters, hostnameVerifier);

    try {
      if (password != null) {
      if (database != 0) {
      if (clientName != null) {
    } catch (JedisException je) {
      throw je;

In the final analysis, pika does not support the client setname command, so when creating a connection, it cannot obtain the connection and report that the command is not supported

Read More: