Skip to content

proposal: explicitly throw error "server that is only able to speak RESP2" instead of "redis.exceptions.ResponseError: unknown command 'hello'" #3058

@MakDon

Description

@MakDon

Version: redis~=5.0.1
Platform: Python 3.9 with macOS 14.1.1 (23B81)

Assume we have a redis server that is only able to speak RESP2.
When trying to call it in RESP3:

redis_client = redis.Redis(host=redis_db_host, port=redis_db_port, protocol=3, password=redis_db_password)
redis_client.set(key, value)

it throws an error:

  File "/venv/lib/python3.9/site-packages/redis/connection.py", line 524, in read_response
    raise response
redis.exceptions.ResponseError: unknown command 'hello'

It is confusing that it complains with the command "hello". And sooner I found that the server does not support RESP3.
It is also documented here:

Similarly, the client can easily detect a server that is only able to speak RESP2:

Client: HELLO 3
Server: -ERR unknown command 'HELLO'

Could we just throw an error about the protocol explicitly instead of complaining about the command 'hello'?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions