{"record":{"id":"d47fb58556a65c87","repo":"apache/druid","slug":"unable-to-fetch-sequence-number-for-partition-s","errorCode":null,"errorMessage":"unable to fetch sequence number for partition[%s] from stream","messagePattern":"unable to fetch sequence number for partition\\[(.+?)\\] from stream","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java","lineNumber":4660,"sourceCode":"              partition,\n              startOffset\n          );\n          return makeSequenceNumber(startOffset, false);\n        }\n      }\n\n      boolean useEarliestSequenceNumber = ioConfig.isUseEarliestSequenceNumber();\n      if (subsequentlyDiscoveredPartitions.contains(partition)) {\n        log.info(\n            \"Overriding useEarliestSequenceNumber and starting from beginning of newly discovered partition [%s] (which is probably from a split or merge)\",\n            partition\n        );\n        useEarliestSequenceNumber = true;\n      }\n\n      sequence = getOffsetFromStreamForPartition(partition, useEarliestSequenceNumber);\n      if (sequence == null) {\n        throw new ISE(\"unable to fetch sequence number for partition[%s] from stream\", partition);\n      }\n      log.debug(\"Getting sequence number [%s] for partition [%s]\", sequence, partition);\n      return makeSequenceNumber(sequence, false);\n    }\n  }\n\n  public Map<PartitionIdType, SequenceOffsetType> getOffsetsFromMetadataStorage()\n  {\n    final DataSourceMetadata dataSourceMetadata = retrieveDataSourceMetadata();\n    if (dataSourceMetadata instanceof SeekableStreamDataSourceMetadata\n        && checkSourceMetadataMatch(dataSourceMetadata)) {\n      @SuppressWarnings(\"unchecked\")\n      SeekableStreamSequenceNumbers<PartitionIdType, SequenceOffsetType> partitions = ((SeekableStreamDataSourceMetadata) dataSourceMetadata)\n          .getSeekableStreamSequenceNumbers();\n      if (partitions != null) {\n        if (!ioConfig.getStream().equals(partitions.getStream())) {\n          log.warn(\n              \"Topic/stream in metadata storage [%s] doesn't match spec topic/stream [%s], ignoring stored sequences\",","sourceCodeStart":4642,"sourceCodeEnd":4678,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java#L4642-L4678","documentation":"The supervisor asked the stream client for an offset for a partition (earliest or latest, depending on useEarliestSequenceNumber) and the client returned null — no offset could be fetched. It throws ISE because a sequence number is mandatory to position the reader for that partition.","triggerScenarios":"getSequenceNumberFromStreamForPartition calls getOffsetFromStreamForPartition(partition, useEarliestSequenceNumber) and receives null — the partition does not exist in the stream, the stream is unreachable/deleted, or the Kinesis shard has no readable records.","commonSituations":"Partition in saved metadata no longer exists in the stream (shard closed/expired); stream deleted or renamed while supervisor still references it; transient AWS/network failures making the describe/GetShardIterator call fail; IAM permissions preventing shard iteration.","solutions":["Verify the stream and partition still exist (Kinesis console / kafka-topics --describe) and recreate or re-point the supervisor spec if the stream was deleted.","Reset the supervisor via the reset API so metadata drops references to dead partitions.","Check network connectivity and IAM permissions (kinesis:GetShardIterator / DescribeStream) if failures are transient.","If partitions legitimately expired, enable partition-expiration handling (Kinesis) or reset so the supervisor stops tracking them."],"exampleFix":"// before: supervisor references partitions of a deleted stream\n\"topic\": \"old-stream-name\"\n// after: update spec to the recreated stream and reset\n\"topic\": \"new-stream-name\" + curl -X POST .../druid/indexer/v1/supervisor/<id>/reset","handlingStrategy":"validation","validationCode":"// confirm all referenced partitions exist before starting\nfor (String p : savedPartitions) {\n    if (getOffsetFromStreamForPartition(p, true) == null) resetSupervisor();\n}","typeGuard":"if (offset == null) { log.warn(\"Partition {} missing from stream\", partition); return null; }","tryCatchPattern":"try { fetchSequence(); } catch (ISE e) { if (e.getMessage().contains(\"unable to fetch sequence number\")) { verifyStreamAndPartitions(); } }","preventionTips":["Monitor stream/partition existence with alerts","Check IAM permissions for GetShardIterator/DescribeStream","Reset supervisor after stream recreation","Track shard expiry for Kinesis"],"tags":["druid","supervisor","offsets","stream"],"backgroundTag":"resource-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}