quickwit-oss/tantivy · error · io::Error

InvalidInput

InvalidInput

Error message

Required column conflicts with another required column of the same type category.

What it means

During a columnar merge, require_type records a per-column required type. If the same column name is required twice with different types in the same type category (both numeric, for instance), the merge cannot satisfy both and raises InvalidInput. Duplicate identical requirements are allowed; only conflicting ones fail.

Source

Thrown at columnar/src/columnar/merge/mod.rs:318

            required_column_type: self.required_column_type,
            columns,
        })
    }

    /// Set the dynamic column for a given columnar.
    fn set_column(&mut self, columnar_id: usize, column: DynamicColumnHandle) {
        self.columns[columnar_id] = Some(column);
    }

    /// Force the existence of a column, as well as its type.
    fn require_type(&mut self, required_type: ColumnType) -> io::Result<()> {
        if let Some(existing_required_type) = self.required_column_type {
            if existing_required_type == required_type {
                // This was just a duplicate in the `required_columns`.
                // Nothing to do.
                return Ok(());
            } else {
                return Err(io::Error::new(
                    io::ErrorKind::InvalidInput,
                    "Required column conflicts with another required column of the same type \
                     category.",
                ));
            }
        }
        self.required_column_type = Some(required_type);
        Ok(())
    }
}

/// Returns the type of the merged numerical column.
///
/// This function picks the first numerical type out of i64, u64, f64 (order matters
/// here), that is compatible with all the `columns`.
///
/// # Panics
/// Panics if one of the column is not numerical.

View on GitHub (pinned to b5d8deb80c)

Solutions

  1. Ensure each column name appears at most once in the required-columns mapping, with a single consistent type
  2. Fix the schema so the column's type is the same across all merged segments
  3. Drop the conflicting requirement for one usage and rely on auto-detected types
  4. Detect the conflict before merging by comparing required types per column and erroring with a clearer message

Example fix

// before
map.require_type("score", ColumnType::U64);
map.require_type("score", ColumnType::I64); // conflict
// after
map.require_type("score", ColumnType::U64);
Defensive patterns

Strategy: validation

Validate before calling

fn check_required_types(reqs: &[(String, ColumnType)]) -> Option<String> {
    let mut seen: std::collections::HashMap<&str, ColumnType> = Default::default();
    for (name, ty) in reqs {
        if let Some(prev) = seen.get(name.as_str()) {
            if *prev != *ty { return Some(name.clone()); }
        } else { seen.insert(name.as_str(), *ty); }
    }
    None
}
// guard: if let Some(c) = check_required_types(&reqs) { fix mapping for c; }

Try / catch

if let Err(e) = merge_mapping.build() {
    if e.kind() == io::ErrorKind::InvalidInput && e.to_string().contains("Required column conflicts") {
        // deduplicate requirements per column name and retry
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Building a merge mapping where require_type (or the higher-level API taking required_columns) is given the same column name with two different required types from the same category, e.g. u64 for one field usage and i64 for another.

Common situations: Merging schemas where one field was redefined between generations (u64 -> i64); programmatic merge mapping built by hand with duplicated column names; schema migration where a stored column and a fast field requirement disagree.

Related errors


AI-assisted analysis of quickwit-oss/tantivy@b5d8deb80c (2026-09-05). Data as JSON: /api/errors/949cff9359142ab6. Report an issue: GitHub.