{"record":{"id":"18cd58377351f684","repo":"elastic/elasticsearch","slug":"cannot-create-past-tsdb-backing-index-for-data-str","errorCode":null,"errorMessage":"Cannot create past TSDB backing index for data stream [{}] because it has no time series backing index. Please rollover first.","messagePattern":"Cannot create past TSDB backing index for data stream \\[(.+?)\\] because it has no time series backing index\\. Please rollover first\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java","lineNumber":376,"sourceCode":"            Set<Instant> coveredTimestamps,\n            Map<Instant, String> rejectedTimestamps,\n            long indexIntervalMillis,\n            long eligibleWriteWindowStart,\n            long requestStartTime\n        ) throws Exception {\n            String dataStreamName = task.dataStreamName();\n            long[] timestamps = task.sortedTimestamps();\n\n            ProjectState projectState = clusterState.projectState(projectResolver.getProjectId());\n            ProjectMetadata currentProject = projectState.metadata();\n            DataStream dataStream = currentProject.dataStreams().get(dataStreamName);\n            validateDataStream(dataStreamName, dataStream, currentProject);\n            ClusterState updatedClusterState = clusterState;\n\n            // From the oldest to the newest\n            Deque<CoveredTimeWindow> stack = retrieveSortedTimeWindows(dataStream, currentProject);\n            if (stack.isEmpty()) {\n                throw new IllegalStateException(\n                    \"Cannot create past TSDB backing index for data stream [\"\n                        + dataStreamName\n                        + \"] because it has no time series backing index. Please rollover first.\"\n                );\n            }\n            CoveredTimeWindow previousIndex = null;\n\n            for (long ts : timestamps) {\n                // We need to reload the data stream metadata to have the latest generation\n                dataStream = updatedClusterState.projectState(projectResolver.getProjectId()).metadata().dataStreams().get(dataStreamName);\n                Instant timestampInstant = Instant.ofEpochMilli(ts);\n                if (ts > requestStartTime) {\n                    rejectedTimestamps.put(\n                        timestampInstant,\n                        \"the document timestamp [\"\n                            + timestampInstant\n                            + \"] is after the request start time [\"\n                            + Instant.ofEpochMilli(requestStartTime)","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java#L358-L394","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rollover the data stream first so at least one backing index with time_series bounds exists.","Confirm the existing backing indices carry index.time_series.start_time/end_time; if not, recreate them via the proper tsdb template.","Retry the past TSDB index creation request after a successful rollover."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure the stream has at least one tsdb backing index with windows before backfill.\nconst windows = await retrieveCoveredTimeWindows(dataStream);\nif (windows.length === 0) {\n  throw new Error(`data stream [${dataStream}] has no time-series backing windows; rollover first`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rollover at least once before running past TSDB index creation.","Verify backing indices carry index.time_series.start_time/end_time before backfill."],"tags":["data-streams","tsdb","past-index-creation","time-series","elasticsearch"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}