databendlabs/databend · error

{msg}

Error message

{msg}

What it means

`load_meta_config` in bendsave reads a databend-meta configuration file, parses it as TOML, and converts `databend_meta_cli_config::Config` into `MetaConfig`. The conversion returns a `String` error which is wrapped with `anyhow!` and propagated verbatim as `{msg}`. The error means the meta config file is syntactically/semantically invalid for the restore tool: wrong keys, missing required fields, or unconvertible values.

Solutions

  1. Read the message text for the underlying cause; fix the TOML syntax or the field it complains about.
  2. Confirm the path points to the meta node's config (e.g. the one used to start databend-meta), not a query/storage config.
  3. Validate required sections (`[storage]`, `[raft_config]`, etc.) exist and match the databend-meta CLI config schema for your version.
  4. Regenerate the config from a known-good template matching your databend version.
  5. Run a TOML linter on the file to catch syntax issues first.
Defensive patterns

Strategy: validation

Validate before calling

let content = std::fs::read_to_string(path)?;
let cfg: toml::Value = toml::from_str(&content)?; // surface syntax errors early
if cfg.get("raft_config").is_none() {
    return Err("missing [raft_config] section in meta config".into());
}

Type guard

fn looks_like_meta_config(cfg: &toml::Value) -> bool {
    cfg.get("raft_config").is_some() && cfg.get("storage").is_some()
}

Try / catch

match bendsave::load_meta_config(path) {
    Ok(cfg) => cfg,
    Err(e) => {
        eprintln!("invalid meta config at {path}: {e}");
        std::process::exit(2);
    }
}

Prevention

When it happens

Trigger: Calling `load_meta_config(path)` (or `restore` which calls it) with a path to a TOML file whose contents fail `toml::from_str` (syntax error) or `try_into::<MetaConfig>()` (missing/invalid fields, mapped to a String message).

Common situations: Pointing bendsave at a query-node or unrelated config file instead of the meta node's config; a meta config written for a different databend version with renamed fields; hand-edited TOML with typos or missing required sections.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/2125e7a902de7c2c. Report an issue: GitHub.

Appendix: source

Thrown at src/bendsave/src/storage.rs:81

/// Load the configuration file and return the operator for databend.
///
/// The given input is the path to databend's configuration file.
pub fn load_query_storage(cfg: &InnerConfig) -> Result<Operator> {
    let op = init_operator(&cfg.storage.params)?;
    debug!("databend storage loaded: {:?}", op.info());
    Ok(op)
}

/// Load the configuration file of databend meta.
///
/// The given input is the path to databend meta's configuration file.
pub fn load_meta_config(path: &str) -> Result<MetaServiceConfig> {
    let content = std::fs::read_to_string(path)?;
    let outer_config: databend_meta_cli_config::Config = toml::from_str(&content)?;
    let meta_config: MetaConfig = outer_config
        .try_into()
        .map_err(|msg: String| anyhow!("{msg}"))?;
    let service_config = meta_config.service;

    if !service_config.raft_config.raft_dir.starts_with("/") {
        return Err(anyhow!(
            "raft_dir of meta service must be an absolute path, but got: {:?}",
            service_config.raft_config.raft_dir
        ));
    }

    debug!("databend meta storage loaded: {:?}", service_config);
    Ok(service_config)
}

/// Init databend query instance so that we can read meta and check license
/// for it.
///
/// FIXME: I really don't like this pattern, but it's how databend work.
pub fn init_query(cfg: &InnerConfig) -> Result<()> {

View on GitHub (pinned to 288d84d76e)