quickwit-oss/quickwit · error
The list of index id patterns may not be empty.
Error message
The list of index id patterns may not be empty.
What it means
Thrown while building a SQL WHERE clause from index id patterns for the PostgreSQL metastore when the resulting positive (non-excluded) pattern list is empty — i.e. every pattern was a negation (leading '-') or empty, so no rows could match.
Source
Thrown at quickwit/quickwit-metastore/src/metastore/postgres/metastore.rs:3135
/// Builds the SQL query that returns indexes matching at least one pattern in
/// `index_id_patterns`, and none of the patterns starting with '-'
///
/// For each pattern, we check whether the pattern is valid and replace `*` by `%`
/// to build a SQL `LIKE` query.
fn build_index_id_patterns_sql_query(index_id_patterns: &[String]) -> anyhow::Result<String> {
let mut positive_patterns = Vec::new();
let mut negative_patterns = Vec::new();
for pattern in index_id_patterns {
if let Some(negative_pattern) = pattern.strip_prefix('-') {
negative_patterns.push(negative_pattern.to_string());
} else {
positive_patterns.push(pattern);
}
}
if positive_patterns.is_empty() {
anyhow::bail!("The list of index id patterns may not be empty.");
}
if index_id_patterns.iter().any(|pattern| pattern == "*") && negative_patterns.is_empty() {
return Ok("SELECT * FROM indexes".to_string());
}
let mut where_like_query = String::new();
for (index_id_pattern_idx, index_id_pattern) in positive_patterns.iter().enumerate() {
validate_index_id_pattern(index_id_pattern, false).map_err(|error| {
MetastoreError::Internal {
message: "failed to build list indexes query".to_string(),
cause: error.to_string(),
}
})?;
if index_id_pattern_idx != 0 {
where_like_query.push_str(" OR ");
}
if index_id_pattern.contains('*') {View on GitHub (pinned to a39730c5cd)
Solutions
- Include at least one positive pattern, e.g. combine "*" with negations: ["*", "-myindex*"]
- If excluding only, list the indexes to include explicitly instead
- Validate the pattern list in the caller before invoking the metastore query
Example fix
// before let patterns = vec!["-stale-*".to_string()]; // after let patterns = vec!["*".to_string(), "-stale-*".to_string()];
Defensive patterns
Strategy: validation
Validate before calling
fn has_positive_pattern(pats: &[String]) -> bool {
pats.iter().any(|p| !p.is_empty() && !p.starts_with('-'))
}
assert!(has_positive_pattern(&patterns), "need at least one positive pattern"); Try / catch
if patterns.iter().all(|p| p.starts_with('-') || p.is_empty()) {
patterns.insert(0, "*".to_string());
}
list_indexes(&patterns).await?; Prevention
- Combine negation patterns with "*" when you only want exclusions
- Validate pattern lists in the CLI layer before hitting the metastore
- Document that all-negative pattern lists are unsupported
When it happens
Trigger: Calling a metastore list/query operation with index_id_patterns consisting only of negative patterns like ["-foo", "-bar"], or all patterns being empty strings.
Common situations: Passing a CLI flag like --index-id-pattern '-myindex*' with no positive pattern; constructing query filters programmatically from empty user input.
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
- not yet implemented
- field does not exist: {}
- source `{}` is defined more than once
- invalid recovery time range: start {start} is after end {end
- recovery time range must contain both start and end
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/33b05f7c1d3346c7.
Report an issue: GitHub.