quickwit-oss/quickwit · error

{left:?} metastore config is defined multiple times

Error message

{left:?} metastore config is defined multiple times

What it means

When validating node configuration, Quickwit collects every configured metastore backend and rejects duplicates: the same backend type (e.g. `postgres`) appearing in more than one metastore config entry is ambiguous, so `validate` sorts backend names and fails when two adjacent entries are equal.

Source

Thrown at quickwit/quickwit-config/src/metastore_config.rs:66

    pub fn redact(&mut self) {
        for metastore_config in &mut self.0 {
            metastore_config.redact();
        }
    }

    pub fn validate(&self) -> anyhow::Result<()> {
        for metastore_config in &self.0 {
            metastore_config.validate()?;
        }
        let backends: Vec<MetastoreBackend> = self
            .0
            .iter()
            .map(|metastore_config| metastore_config.backend())
            .sorted()
            .collect();

        for (left, right) in backends.iter().zip(backends.iter().skip(1)) {
            ensure!(
                left != right,
                "{left:?} metastore config is defined multiple times"
            );
        }
        Ok(())
    }

    pub fn find_file(&self) -> Option<&FileMetastoreConfig> {
        self.0
            .iter()
            .find_map(|metastore_config| match metastore_config {
                MetastoreConfig::File(file_metastore_config) => Some(file_metastore_config),
                _ => None,
            })
    }

    pub fn find_postgres(&self) -> Option<&PostgresMetastoreConfig> {
        self.0

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Remove the duplicate metastore config block, keeping exactly one per backend
  2. If merging files is the cause, drop or override the entry in one of the files instead of concatenating
  3. Run `quickwit config validate` (or equivalent) after any config merge to catch duplicates early

Example fix

// before (duplicate postgres blocks)
metastore:
  uri: postgres://a
  uri: postgres://b
// after
metastore:
  uri: postgres://a
Defensive patterns

Strategy: validation

Validate before calling

fn ensure_unique_metastore_backends(config: &NodeConfig) -> anyhow::Result<()> {
    let mut backends: Vec<_> = config.metastore_configs()
        .iter().map(|m| m.backend()).collect();
    backends.sort();
    backends.dedup();
    if backends.len() != config.metastore_configs().len() {
        anyhow::bail!("duplicate metastore backend configs detected");
    }
    Ok(())
}

Try / catch

if let Err(e) = node_config.validate() {
    if e.to_string().contains("metastore config is defined multiple times") {
        eprintln!("Check for duplicated metastore blocks across merged config files.");
    }
}

Prevention

When it happens

Trigger: A node config file (quickwit.yaml) listing the same metastore backend twice — e.g. two `postgres` blocks or repeated `metastore` entries after merging multiple config files.

Common situations: Merging config files/overlays where both a base and an override file define the same metastore; hand-editing config and duplicating a block; templating that appends a metastore entry unconditionally.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/c6a62e31fc4bd1bd. Report an issue: GitHub.