{"record":{"id":"9429f6e87d2e47a3","repo":"risingwavelabs/risingwave","slug":"failed-to-list-kinesis-shards","errorCode":null,"errorMessage":"failed to list kinesis shards","messagePattern":"failed to list kinesis shards","errorType":"exception","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/source/kinesis/enumerator/client.rs","lineNumber":72,"sourceCode":"        loop {\n            let mut req = self.client.list_shards();\n            if let Some(token) = next_token.take() {\n                req = req.next_token(token);\n            } else {\n                req = req.stream_name(&self.stream_name);\n            }\n\n            let list_shard_output = match req.send().await {\n                Ok(output) => output,\n                Err(e) => {\n                    if let Some(e_inner) = e.as_service_error()\n                        && e_inner.is_expired_next_token_exception()\n                    {\n                        tracing::info!(\"Kinesis ListShard token expired, retrying...\");\n                        next_token = None;\n                        continue;\n                    }\n                    return Err(anyhow!(e).context(\"failed to list kinesis shards\").into());\n                }\n            };\n            match list_shard_output.shards {\n                Some(shard) => shard_collect.extend(shard),\n                None => bail!(\"no shards in stream {}\", &self.stream_name),\n            }\n\n            match list_shard_output.next_token {\n                Some(token) => next_token = Some(token),\n                None => break,\n            }\n        }\n        Ok(shard_collect\n            .into_iter()\n            .map(|x| KinesisSplit {\n                shard_id: x.shard_id().to_owned().into(),\n                // handle start with position in reader part\n                next_offset: KinesisOffset::None,","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/kinesis/enumerator/client.rs#L54-L90","documentation":"In the Kinesis split enumerator client (`list_splits`, src/connector/src/source/kinesis/enumerator/client.rs:72), a `list_shard` SDK call (including retries via `next_token`) returned an error that was not an expired-token retryable case. The SDK error is wrapped with `anyhow!` and given the context \"failed to list kinesis shards\", so the original AWS SDK error is preserved as the chain source.","triggerScenarios":"Kinesis `ListShards` API call fails due to stream not existing, IAM permission denial (kinesis:ListShards), throttling (LimitExceededException), network errors, or any non-expired-token SDK error surfaced during split enumeration.","commonSituations":"Misconfigured AWS credentials or region, missing `kinesis:ListShards` IAM permission, stream name typo, stream recently deleted, or Kinesis throttling under load.","solutions":["Inspect the chained SDK error (source of the anyhow error) to identify the root cause (throttling, permission, or missing stream).","Verify IAM policy grants `kinesis:ListShards` on the stream resource.","Verify the stream name in the source WITH options and that the stream exists in the configured region.","If throttled (LimitExceededException), retry later or reduce enumeration frequency; expired NextToken cases are already retried internally."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before creating the source, check access and stream existence\naws kinesis list-shards --stream-name <stream> --region <region>\n// Success proves credentials, region, and kinesis:ListShards are OK","typeGuard":null,"tryCatchPattern":"// Wrap enumeration with retry on transient SDK errors; inspect the anyhow chain\nmatch enumerator.list_splits().await {\n    Err(e) if e.root_cause().downcast_ref::<SdkError<ListShardsError>>().map_or(false, is_throttling) => {\n        tokio::time::sleep(backoff).await; // retry\n    }\n    Err(e) => return Err(e.context(\"failed to list kinesis shards\")),\n    Ok(splits) => splits,\n}","preventionTips":["Grant kinesis:ListShards to the source's IAM role","Validate stream name and region before source creation","Configure retry/backoff for throttling (LimitExceededException)","Test credentials with `aws kinesis list-shards` before wiring the source"],"tags":["kinesis","aws","network","permissions"],"backgroundTag":"api-request-failed","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}