Skip to content

Standardize error messages to match Redis 7.2 spec #25

Description

@mack42

Source: Audit finding M7

Error messages are inconsistent in wording and format compared to Redis 7.2. Examples:

  • "ERR invalid expire time in 'set' command"
  • "ERR value is not an integer or out of range"
  • "WRONGTYPE Operation against a key holding the wrong kind of value"

Some are correct; many are ad-hoc. Real Redis has a small set of well-known error prefixes (`ERR`, `WRONGTYPE`, `MOVED`, `ASK`, `NOSCRIPT`, `BUSY`, `LOADING`, `OOM`, `READONLY`, `MASTERDOWN`, `MISCONF`, `NOREPLICAS`, `NOAUTH`, `WRONGPASS`, `NOPROTO`).

Suggested approach: Define an `enum RedisError` with variants for each prefix + payload, then `impl From for RespValue`. Sweep command handlers to use the enum. Add a test that diffs sample command outputs against expected Redis 7.2 wording for the parity-critical commands.

Scope: ~40 command files, ~hundreds of `RespValue::error(...)` call sites.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttier-2Medium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions