quickwit-oss/quickwit · error

metastore factory and config backends do not match: {:?} vs.

Error message

metastore factory and config backends do not match: {:?} vs. {:?}

What it means

MetastoreResolver::build validates its internal state: for every protocol it registers, the registered metastore factory's backend() must equal the backend declared for that protocol in the resolver's config map. A mismatch means the builder was given inconsistent registrations (e.g. a factory registered under a URI scheme whose config backend differs). This is an internal consistency check to catch builder misuse.

Source

Thrown at quickwit/quickwit-metastore/src/metastore_resolver.rs:183

    per_protocol_factories: HashMap<MetastoreBackend, (Box<dyn MetastoreFactory>, MetastoreConfig)>,
}

impl MetastoreResolverBuilder {
    pub fn register<S: MetastoreFactory>(
        mut self,
        metastore_factory: S,
        metastore_config: MetastoreConfig,
    ) -> Self {
        self.per_protocol_factories.insert(
            metastore_factory.backend(),
            (Box::new(metastore_factory), metastore_config),
        );
        self
    }

    pub fn build(self) -> anyhow::Result<MetastoreResolver> {
        for (metastore_factory, metastore_config) in self.per_protocol_factories.values() {
            ensure!(
                metastore_factory.backend() == metastore_config.backend(),
                "metastore factory and config backends do not match: {:?} vs. {:?}",
                metastore_factory.backend(),
                metastore_config.backend(),
            );
        }
        let metastore_resolver = MetastoreResolver {
            per_backend_factories: Arc::new(self.per_protocol_factories),
        };
        Ok(metastore_resolver)
    }
}

#[cfg(test)]
mod tests {
    use std::str::FromStr;

    use super::*;

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Check each `register_factory(protocol, ...)` call and ensure the factory's backend matches the backend configured for that protocol.
  2. Update the protocol key so it matches the factory's backend (e.g. register a PostgreSQL factory under `postgres`).
  3. If this appears without custom code, report it — it indicates an internal wiring bug in Quickwit.

Example fix

// before
resolver.register_factory("postgres", FileMetastoreFactory::default());
// after
resolver.register_factory("postgres", PostgresqlMetastoreFactory::default());
Defensive patterns

Strategy: validation

Validate before calling

// assert before build()
assert_eq!(factory.backend(), config_backend_for_protocol(protocol),
    "factory/config backend mismatch for protocol {protocol}");

Prevention

When it happens

Trigger: Calling `MetastoreResolverBuilder::build()` after registering a metastore factory under a protocol whose configured backend does not match the factory's backend, typically via `register_factory`/config registration with mismatched schemes.

Common situations: Custom metastore extensions registering a factory under the wrong URI scheme; code wiring a postgres factory to the file protocol (or vice versa); refactoring backend enums so backend() changed while registration keys stayed stale.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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