risingwavelabs/risingwave · error · ConnectorError

no shards in stream {}

Error message

no shards in stream {}

What it means

In the Kinesis split enumerator client (`list_splits`, src/connector/src/source/kinesis/enumerator/client.rs:77), the `ListShards` API succeeded but returned `shards: None`, meaning Kinesis reported no shards for the stream. The enumerator treats this as a hard error via `bail!("no shards in stream {}", &self.stream_name)` rather than returning an empty split list.

Source

Thrown at src/connector/src/source/kinesis/enumerator/client.rs:77

                req = req.stream_name(&self.stream_name);
            }

            let list_shard_output = match req.send().await {
                Ok(output) => output,
                Err(e) => {
                    if let Some(e_inner) = e.as_service_error()
                        && e_inner.is_expired_next_token_exception()
                    {
                        tracing::info!("Kinesis ListShard token expired, retrying...");
                        next_token = None;
                        continue;
                    }
                    return Err(anyhow!(e).context("failed to list kinesis shards").into());
                }
            };
            match list_shard_output.shards {
                Some(shard) => shard_collect.extend(shard),
                None => bail!("no shards in stream {}", &self.stream_name),
            }

            match list_shard_output.next_token {
                Some(token) => next_token = Some(token),
                None => break,
            }
        }
        Ok(shard_collect
            .into_iter()
            .map(|x| KinesisSplit {
                shard_id: x.shard_id().to_owned().into(),
                // handle start with position in reader part
                next_offset: KinesisOffset::None,
                end_offset: KinesisOffset::None,
            })
            .collect())
    }
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Confirm the stream actually has shards: run `aws kinesis list-shards --stream-name <name>`.
  2. If the stream was just created, wait a few seconds for shard metadata to propagate, then create the source.
  3. Verify the stream name and region in the source WITH options match the intended stream.
  4. If the stream is empty by design, create at least one shard (e.g. via put-record on an open shard or resize the stream) before sourcing from it.
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the stream has shards before creating the source
const { KinesisClient, ListShardsCommand } = require('@aws-sdk/client-kinesis');
const out = await client.send(new ListShardsCommand({ StreamName: streamName }));
if (!out.Shards || out.Shards.length === 0) {
  throw new Error(`stream ${streamName} has no shards yet; wait or add a shard`);
}

Try / catch

match enumerator.list_splits().await {
    Err(e) if e.to_string().starts_with("no shards in stream") => {
        // stream exists but has no shards: wait and re-check the stream
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `list_splits` against a Kinesis stream that exists but has zero shards — e.g. a freshly created stream whose shard list has not propagated, or a stream drained/closed with no active shards.

Common situations: Creating a RisingWave source immediately after `create-stream` before Kinesis metadata is consistent, or pointing at an empty/test stream with no shards; also possible with a stream name pointing at the wrong region's stream.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/94c37ff67c23df41. Report an issue: GitHub.