quickwit-oss/quickwit · error
`index_id_patterns` must not be empty
Error message
`index_id_patterns` must not be empty
What it means
`IndexTemplate::validate` requires an index template to declare at least one `index_id_pattern`, since a template with no patterns can never match any index id. Before checking each pattern's validity, it ensures the list is not empty and fails fast with this message.
Solutions
- Add at least one index id pattern, e.g. `index_id_patterns: ["my-index-*"]`
- If the template should not match anything, remove the template instead of emptying its patterns
- Validate the generated template JSON/YAML before submission
Example fix
// before index_id_patterns: [] // after index_id_patterns: - "my-index-*"
Defensive patterns
Strategy: validation
Validate before calling
function validateTemplate(tpl) {
if (!Array.isArray(tpl.index_id_patterns) || tpl.index_id_patterns.length === 0) {
throw new Error("index_id_patterns must contain at least one pattern");
}
return true;
} Type guard
function hasIndexIdPatterns(tpl) {
return Array.isArray(tpl.index_id_patterns) && tpl.index_id_patterns.length > 0;
} Try / catch
try {
client.sendIndexTemplateRequest(request).await?;
} catch (e) {
if (e.message.includes("`index_id_patterns` must not be empty")) {
console.error("Add at least one index_id_pattern to the template.");
} else { throw e; }
} Prevention
- Always declare at least one wildcard pattern (e.g. `logs-*`) when authoring a template
- Lint template JSON/YAML for empty arrays before submission
- Remove unused templates entirely rather than stripping their patterns
When it happens
Trigger: Submitting an index template (via the template API or a template config file) where the `index_id_patterns` array is missing or empty `[]`.
Common situations: Creating a template programmatically and forgetting to populate patterns; a config generation bug that emits an empty list; cleaning out patterns before re-adding them and applying the half-finished template.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- concatenate field uses an unknown field
- contains an empty label name
- contains an empty label value
- `desired_num_pipelines` must be strictly positive
- document clustering fingerprint policy must contain at…
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/b1eabbcf3a3a1656.
Report an issue: GitHub.
Appendix: source
Thrown at quickwit/quickwit-config/src/index_template/mod.rs:87
let mut doc_mapping = self.doc_mapping.clone();
doc_mapping.doc_mapping_uid = DocMappingUid::random();
let index_config = IndexConfig {
index_id,
index_uri,
doc_mapping,
indexing_settings: self.indexing_settings.clone(),
ingest_settings: self.ingest_settings.clone(),
search_settings: self.search_settings.clone(),
retention_policy_opt: self.retention_policy_opt.clone(),
};
Ok(index_config)
}
pub fn validate(&self) -> anyhow::Result<()> {
validate_identifier("template", &self.template_id)?;
ensure!(
!self.index_id_patterns.is_empty(),
"`index_id_patterns` must not be empty"
);
for index_id_pattern in &self.index_id_patterns {
validate_index_id_pattern(index_id_pattern, true)?;
}
validate_index_config(
&self.doc_mapping,
&self.indexing_settings,
&self.search_settings,
&self.retention_policy_opt,
)?;
Ok(())
}
#[cfg(any(test, feature = "testsuite"))]
pub fn for_test(template_id: &str, index_id_patterns: &[&str], priority: usize) -> Self {
let index_id_patterns: Vec<IndexIdPattern> = index_id_patternsView on GitHub (pinned to a39730c5cd)