nautechsystems/nautilus_trader · error

Duplicate data catalog name

Error message

Duplicate data catalog name '{name}'

What it means

When building the kernel with streaming/catalog configuration, each configured data catalog is assigned a name (explicit or auto-generated catalog_N). Names are collected into a set, and if two catalogs resolve to the same name the kernel refuses to start with this error, because catalog lookups by name would be ambiguous.

Solutions

  1. Give every catalog in config.catalogs() a unique explicit name
  2. Check for duplicated catalog blocks in the config file (copy-paste errors)
  3. Rename any manual catalog name that could collide with generated names (catalog_0, catalog_1, ...) — prefer descriptive names like "parquet-main"
  4. Log the resolved catalog names during startup to spot collisions before the kernel builds

Example fix

// before: duplicate names
catalogs: [CatalogConfig { name: Some("main"), .. }, CatalogConfig { name: Some("main"), .. }]
// after
catalogs: [CatalogConfig { name: Some("main"), .. }, CatalogConfig { name: Some("archive"), .. }]
Defensive patterns

Strategy: validation

Validate before calling

fn catalog_names_unique(configs: &[CatalogConfig]) -> Result<(), String> {
    let mut seen = std::collections::HashSet::new();
    for (i, c) in configs.iter().enumerate() {
        let name = c.name.clone().unwrap_or(format!("catalog_{i}"));
        if !seen.insert(name.clone()) {
            return Err(format!("duplicate catalog name: {name}"));
        }
    }
    Ok(())
}

Try / catch

match Kernel::new_with_dependencies(...) {
    Err(e) if e.to_string().contains("Duplicate data catalog name") => {
        eprintln!("fix catalog names in config: {e}");
        std::process::exit(2);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Configuring two or more catalogs in the TradingKernelConfig with the same explicit name, or relying on auto-generated names that collide after a manual name equals a generated one (e.g. an explicit "catalog_0" plus an unnamed catalog).

Common situations: Copy-pasting a catalog block in the config without renaming it; merging config files that each define a default-named catalog; an explicitly named catalog like catalog_1 colliding with the second unnamed catalog's generated name.

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 nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/0df839eaaaf6c864. Report an issue: GitHub.

Appendix: source

Thrown at crates/system/src/kernel.rs:346

        let exec_engine = Rc::new(RefCell::new(exec_engine));

        let order_emulator = OrderEmulatorAdapter::new(clock.clone(), cache.clone());

        let data_engine = DataEngine::new(clock.clone(), cache.clone(), config.data_engine());
        #[cfg(feature = "streaming")]
        let mut data_engine = data_engine;
        #[cfg(feature = "streaming")]
        {
            let mut unnamed_index = 0;
            let mut catalog_names = HashSet::new();

            for catalog_config in config.catalogs() {
                let name = catalog_config.name.clone().unwrap_or_else(|| {
                    let name = format!("catalog_{unnamed_index}");
                    unnamed_index += 1;
                    name
                });
                anyhow::ensure!(
                    catalog_names.insert(name.clone()),
                    "Duplicate data catalog name '{name}'",
                );
                let catalog = catalog_config.create_catalog().with_context(|| {
                    format!(
                        "Failed to create data catalog from '{}'",
                        catalog_config.path
                    )
                })?;
                data_engine.register_catalog(catalog, Some(&name));
            }
        }
        let data_engine = Rc::new(RefCell::new(data_engine));

        DataEngine::register_msgbus_handlers(&data_engine);
        RiskEngine::register_msgbus_handlers(&risk_engine);
        ExecutionEngine::register_msgbus_handlers(&exec_engine);
        OrderEmulator::register_msgbus_handlers(&order_emulator.emulator());

View on GitHub (pinned to 18893faf8b)