{"record":{"id":"6e467ead8598cae5","repo":"risingwavelabs/risingwave","slug":"shard-iterator-is-none","errorCode":null,"errorMessage":"shard iterator is none","messagePattern":"shard iterator is none","errorType":"exception","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/source/kinesis/source/reader.rs","lineNumber":376,"sourceCode":"            starting_seq_num: Option<String>,\n            starting_timestamp: Option<DateTime>,\n            iter_type: ShardIteratorType,\n        ) -> Result<String> {\n            let resp = client\n                .get_shard_iterator()\n                .stream_name(stream_name)\n                .shard_id(shard_id)\n                .shard_iterator_type(iter_type)\n                .set_starting_sequence_number(starting_seq_num)\n                .set_timestamp(starting_timestamp)\n                .send()\n                .await\n                .context(\"failed to get kinesis shard iterator\")?;\n\n            if let Some(iter) = resp.shard_iterator() {\n                Ok(iter.to_owned())\n            } else {\n                bail!(\"shard iterator is none\")\n            }\n        }\n\n        self.shard_iter = Some(\n            tokio_retry::Retry::spawn(\n                exponential_backoff(Duration::from_millis(100), 2, Duration::MAX).take(3),\n                || {\n                    get_shard_iter_inner(\n                        &self.client,\n                        &self.stream_name,\n                        &self.shard_id,\n                        starting_seq_num.clone(),\n                        start_timestamp,\n                        iter_type.clone(),\n                    )\n                },\n            )\n            .await?,","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/kinesis/source/reader.rs#L358-L394","documentation":"In `get_shard_iter_inner` (called from `new_shard_iter`), after calling Kinesis `GetShardIterator` the response's optional `shard_iterator` field is expected to be present. If AWS returns success but no iterator (`resp.shard_iterator()` is None), the code `bail!`s with \"shard iterator is none\". This is wrapped by a retry with exponential backoff (3 attempts) in `new_shard_iter` before ultimately failing.","triggerScenarios":"AWS GetShardIterator succeeds with HTTP 200 but omits shard_iterator — typically when the requested starting position is not yet available (TRIM_HORIZON/LATEST edge cases), the shard is in an inconsistent state, or the AWS SDK returns an empty/degenerate response.","commonSituations":"Recently created or just-resharded (merged/split) shards whose iterators are momentarily unavailable; throttled region endpoints returning empty bodies; very old shards where the requested sequence position no longer exists.","solutions":["Wait and retry — the connector already retries 3 times with exponential backoff starting at 100ms; a transient condition usually resolves.","Verify the shard_id is current: resharding invalidates shard lists; restart the source so the enumerator refreshes shards.","Switch startup mode to 'latest' or 'earliest' if a timestamp/sequence position is unavailable for the shard.","If persistent, check the AWS region configuration matches the stream's region."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The connector already retries internally; on final failure, wrap with backoff restart\nmatch start_source(source_id).await {\n    Err(e) if e.to_string().contains(\"shard iterator is none\") => {\n        tokio::time::sleep(Duration::from_secs(30)).await;\n        start_source(source_id).await?; // shard state / resharding usually settles\n    }\n    other => other?;\n}","preventionTips":["Avoid querying very fresh shards immediately after stream creation or resharding.","Keep the shard list refreshed by restarting/replanning the source after reshard operations.","Use 'latest' or 'earliest' startup modes when a specific timestamp position may be unavailable.","Confirm the configured AWS region matches the stream's region."],"tags":["kinesis","aws-sdk","shard-iterator","retry"],"backgroundTag":"unexpected-response-shape","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"}