elastic/elasticsearch · error · IllegalStateException

Cannot create past TSDB backing index for data stream [{}] b

Error message

Cannot create past TSDB backing index for data stream [{}] because it has no time series backing index. Please rollover first.

What it means

Thrown in TransportPastTimeSeriesIndexCreationAction when retrieveSortedTimeWindows returns an empty deque, meaning the data stream has no backing indices with usable time-series windows to chain from. Past TSDB index creation needs an existing window boundary to compute the new index's bounds; with none present it cannot proceed and asks the user to rollover first.

Source

Thrown at modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java:376

            Set<Instant> coveredTimestamps,
            Map<Instant, String> rejectedTimestamps,
            long indexIntervalMillis,
            long eligibleWriteWindowStart,
            long requestStartTime
        ) throws Exception {
            String dataStreamName = task.dataStreamName();
            long[] timestamps = task.sortedTimestamps();

            ProjectState projectState = clusterState.projectState(projectResolver.getProjectId());
            ProjectMetadata currentProject = projectState.metadata();
            DataStream dataStream = currentProject.dataStreams().get(dataStreamName);
            validateDataStream(dataStreamName, dataStream, currentProject);
            ClusterState updatedClusterState = clusterState;

            // From the oldest to the newest
            Deque<CoveredTimeWindow> stack = retrieveSortedTimeWindows(dataStream, currentProject);
            if (stack.isEmpty()) {
                throw new IllegalStateException(
                    "Cannot create past TSDB backing index for data stream ["
                        + dataStreamName
                        + "] because it has no time series backing index. Please rollover first."
                );
            }
            CoveredTimeWindow previousIndex = null;

            for (long ts : timestamps) {
                // We need to reload the data stream metadata to have the latest generation
                dataStream = updatedClusterState.projectState(projectResolver.getProjectId()).metadata().dataStreams().get(dataStreamName);
                Instant timestampInstant = Instant.ofEpochMilli(ts);
                if (ts > requestStartTime) {
                    rejectedTimestamps.put(
                        timestampInstant,
                        "the document timestamp ["
                            + timestampInstant
                            + "] is after the request start time ["
                            + Instant.ofEpochMilli(requestStartTime)

View on GitHub (pinned to db6a809a66)

Solutions

  1. Rollover the data stream first so at least one backing index with time_series bounds exists.
  2. Confirm the existing backing indices carry index.time_series.start_time/end_time; if not, recreate them via the proper tsdb template.
  3. Retry the past TSDB index creation request after a successful rollover.
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the stream has at least one tsdb backing index with windows before backfill.
const windows = await retrieveCoveredTimeWindows(dataStream);
if (windows.length === 0) {
  throw new Error(`data stream [${dataStream}] has no time-series backing windows; rollover first`);
}

Prevention

When it happens

Trigger: Calling the past TSDB index creation API on a data stream whose backing indices have no time_series start/end windows (e.g. first generation never created, all backing indices stripped of bounds, or a freshly created stream with no rollover yet). validateDataStream passes (write index exists and is tsdb) but no covered windows are recoverable.

Common situations: Running past-time backfill before the stream has had its first rollover; restoring a stream whose backing index metadata lost time_series bounds; operating on a brand-new stream too early.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/18cd58377351f684. Report an issue: GitHub.