elastic/elasticsearch · error · ResourceNotFoundException
data stream [{}] does not exist
Error message
data stream [{}] does not exist What it means
ResourceNotFoundException from promoteDataStream when project.dataStreams().get(name) returns null. The promote operation (converts a stand-in/replicated stream into a regular one) requires the stream to already exist in the project metadata.
Source
Thrown at modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPromoteDataStreamAction.java:111
@Override
public void clusterStateProcessed(ClusterState oldState, ClusterState newState) {
listener.onResponse(AcknowledgedResponse.TRUE);
}
}
);
}
@SuppressForbidden(reason = "legacy usage of unbatched task") // TODO add support for batching here
private void submitUnbatchedTask(@SuppressWarnings("SameParameterValue") String source, ClusterStateUpdateTask task) {
clusterService.submitUnbatchedStateUpdateTask(source, task);
}
static ProjectMetadata promoteDataStream(ProjectMetadata project, PromoteDataStreamAction.Request request) {
DataStream dataStream = project.dataStreams().get(request.getName());
if (dataStream == null) {
throw new ResourceNotFoundException("data stream [" + request.getName() + "] does not exist");
}
warnIfTemplateMissingForDatastream(dataStream, project);
DataStream promotedDataStream = dataStream.promoteDataStream();
return ProjectMetadata.builder(project).put(promotedDataStream).build();
}
private static void warnIfTemplateMissingForDatastream(DataStream dataStream, ProjectMetadata project) {
var datastreamName = dataStream.getName();
var matchingIndex = project.templatesV2()
.values()
.stream()
.filter(cit -> cit.getDataStreamTemplate() != null)
.flatMap(cit -> cit.indexPatterns().stream())
.anyMatch(pattern -> Regex.simpleMatch(pattern, datastreamName));
View on GitHub (pinned to db6a809a66)
Solutions
- List streams with GET _data_stream to get the exact name
- Confirm you are connected to the cluster/project that owns the stream
- Create the data stream first if promotion of a brand-new stream was intended
Example fix
// before POST _data_stream/mylog/_promote // name typo // after GET _data_stream/my-logs* // find real name POST _data_stream/my-logs/_promote
Defensive patterns
Strategy: validation
Validate before calling
// Resolve the stream existence before promoting:
if (!dataStreamExists(name)) {
throw new ResourceNotFoundException("data stream " + name + " does not exist");
}
promoteDataStream(name); Try / catch
try { promoteDataStream(name); }
catch (ResourceNotFoundException e) { /* list streams, surface actionable error to caller */ } Prevention
- Cache the list of data stream names and validate inputs against it
- Use deterministic naming so promotion targets are unambiguous
- Run promotion against the leader cluster, not a follower
When it happens
Trigger: POST _data_stream/<name>/_promote (PromoteDataStreamAction) where <name> is not present in the cluster's data stream metadata. The static promoteDataStream method is invoked after the request is dispatched and it fails fast on the null lookup.
Common situations: Typo in the data stream name; promoting on the wrong cluster/project; the stream was deleted between the lookup and the call; cross-cluster replication follower where the stream lives on the leader only.
Related errors
- data streams {} not found
- Data stream [{}] not found
- no data stream actions specified, at least one must be speci
- Branch {branch} does not exist
- backing index [%s] in tsdb mode doesn't have the [%s] index
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/062897835590e020.
Report an issue: GitHub.