elastic/elasticsearch · error · RuntimeException
Failed to determine indexMode for data stream: {}
Error message
Failed to determine indexMode for data stream: {} What it means
Thrown by TransportGetDataStreamsAction while resolving the index mode of a data stream when resolveMode throws an IOException (template parsing, settings merge, or mode computation failure). It is wrapped in a RuntimeException because the cluster-state applier path does not declare checked IOException; the original IOException is preserved as the cause.
Source
Thrown at modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportGetDataStreamsAction.java:308
state.metadata()
);
Settings templateSettings = MetadataIndexTemplateService.resolveSettings(
template,
state.metadata().componentTemplates()
);
final Settings settings = templateSettings.merge(dataStream.getSettings());
ilmPolicyName = settings.get(IndexMetadata.LIFECYCLE_NAME);
if (indexMode == null && state.metadata().templatesV2().get(indexTemplate) != null) {
try {
indexMode = resolveMode(
state,
indexSettingProviders,
dataStream,
settings,
dataStream.getEffectiveIndexTemplate(state.metadata())
);
} catch (IOException e) {
throw new RuntimeException("Failed to determine indexMode for data stream: " + dataStream.getName(), e);
}
}
indexTemplatePreferIlmValue = PREFER_ILM_SETTING.get(settings);
} else {
LOGGER.warn(
"couldn't find any matching template for data stream [{}]. has it been restored (and possibly renamed)"
+ "from a snapshot?",
dataStream.getName()
);
}
}
ClusterStateHealth streamHealth = new ClusterStateHealth(
state.cluster(),
dataStream.getIndices().stream().map(Index::getName).toArray(String[]::new),
state.projectId()
);
View on GitHub (pinned to db6a809a66)
Solutions
- Inspect the wrapped IOException cause for the underlying parse/merge failure.
- Correct or recreate the offending composable index template referenced by the data stream.
- If caused by version skew, ensure all nodes are on a compatible version and re-simulate the template with POST _index_template/_simulate_index.
Defensive patterns
Strategy: try-catch
Try / catch
try {
DataStream resolved = resolveMode(state, providers, dataStream, settings, template);
} catch (IOException | RuntimeException e) {
Throwable cause = e.getCause() != null ? e.getCause() : e;
log.warn("failed to determine indexMode for data stream {}", dataStream.getName(), cause);
// surface a clearer error to the caller; do not silently default the mode
throw new IllegalStateException("cannot resolve index mode for " + dataStream.getName(), cause);
} Prevention
- Keep composable index templates well-formed and version-compatible across nodes.
- After upgrade/restore, simulate templates with POST _index_template/_simulate_index to catch parse errors early.
When it happens
Trigger: GET _data_stream during a state where the data stream's effective index template is present but its composable template definition fails to parse or its settings cannot be merged to compute a mode. Corrupted/invalid template metadata in the cluster state triggers it.
Common situations: Cluster state with a malformed or version-mismatched index template after upgrade/restore; concurrent template update leaving transient inconsistency; custom index_setting_provider throwing.
Related errors
- backing index [%s] in tsdb mode doesn't have the [%s] index
- Cannot add dynamic templates that define dimension fields on
- Expected at most one {} implementation, found: {}
- failed to parse value%s for setting [%s], must be lower than
- data streams {} not found
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/0b1fa3e1374d63c9.
Report an issue: GitHub.