Skip to content

[BUG] Attempting to read last entry of empty stream throws error #2728

@thearchitector

Description

@thearchitector

Describe the bug

If you attempt to read the last entry of an empty stream using XREAD STREAMS blah +, you get an error. It should be returning nil instead.

To reproduce

127.0.0.1:6379> xgroup create blah blah 0 MKSTREAM
OK
127.0.0.1:6379> xread STREAMS blah +
(error) ERR the stream last element ID is 0-0

Expected behavior

Valkey should return a nil response instead of an error, as with Redis:

127.0.0.1:6379> xgroup create blah blah 0 MKSTREAM
OK
127.0.0.1:6379> xread STREAMS blah +
(nil)
127.0.0.1:6379>

Additional information

This happens use the latest valkey/valkey:alpine image.

The source indicates this error should be impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions