XAUTOCLAIM-ID
RedisERRORNotableStreamsHIGH confidence

The ID specified in XAUTOCLAIM is invalid

Production Risk

Low. The server correctly rejects an invalid argument.

What this means

This error occurs when using the XAUTOCLAIM command on a Stream, and the provided starting ID is not a valid stream ID or does not exist in the Pending Entries List (PEL) for the specified consumer group.

Why it happens
  1. 1The provided stream ID has a malformed structure (must be `timestamp-sequence`).
  2. 2The ID is `0-0`, which is not a valid starting point for claiming; you must start from an actual pending entry.
  3. 3The ID refers to an entry that is not currently pending or has already been claimed and acknowledged.
How to reproduce

A client tries to auto-claim entries from a stream starting with an invalid ID like '0-0'.

trigger — this will error
trigger — this will error
XAUTOCLAIM mystream mygroup consumer-1 3600000 0-0 COUNT 1

expected output

(error) ERR The ID specified in XAUTOCLAIM is invalid: it must be > 0-0 and must be an existing ID in the PEL.

Fix 1

Use `XPENDING` to find a valid starting ID

WHEN Before starting a claiming process

Use `XPENDING` to find a valid starting ID
# Find the first pending entry
XPENDING mystream mygroup - + 1
# Use the ID returned from the above command in XAUTOCLAIM

Why this works

The `XPENDING` command allows you to inspect the list of pending messages. By fetching the first pending entry, you get a valid ID to use as the starting point for `XAUTOCLAIM`.

Fix 2

Start claiming from the beginning of time for the group

WHEN To process all pending messages for a given consumer

Start claiming from the beginning of time for the group
XPENDING mystream mygroup
# ... then iterate over pending messages for that consumer

Why this works

A common pattern for a recovery worker is to scan the entire PEL for a consumer group and then attempt to claim messages that have been idle for a certain period.

What not to do

Guess stream IDs

Stream IDs have a specific structure and meaning. Guessing an ID will almost certainly fail. Always retrieve a valid ID from a command like `XPENDING` or from a previous read.

Sources
Official documentation ↗

Stream data structure and consumer group logic.

Redis Streams Introduction

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Redis errors