zeroclaw-labs/zeroclaw · warning · DiagItem

config section `{$path}` is malformed and was reset to defau

Error message

config section `{$path}` is malformed and was reset to defaults; values in that section are NOT in effect. Run `zeroclaw config migrate` to see the parse error, then repair the file.

What it means

The resilient config loader replaces sections that fail to parse with defaults and records their paths in `degraded_sections`. Doctor surfaces each path as this warning: the values currently in effect for that section are NOT your file's values — they are silent defaults. (Security sections degrade to an error; this warning covers the rest.)

Source

Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1101

/// Surface config sections the resilient loader dropped at load time
/// (`Config::degraded_sections` / `Config::degraded_security`, populated by
/// `migrate_to_current_salvaged` in `zeroclaw-config`) so `doctor` names the
/// actual malformed section instead of downstream checks reporting confusing
/// secondary symptoms (e.g. "no channels configured").
fn check_degraded_sections(config: &Config, items: &mut Vec<DiagItem>) {
    let cat = "config";
    for path in &config.degraded_security {
        items.push(DiagItem::error(
            cat,
            crate::i18n::get_required_cli_string_with_args(
                "cli-doctor-degraded-security",
                &[("path", path.as_str())],
            ),
        ));
    }
    for path in &config.degraded_sections {
        items.push(DiagItem::warn(
            cat,
            crate::i18n::get_required_cli_string_with_args(
                "cli-doctor-degraded-section",
                &[("path", path.as_str())],
            ),
        ));
    }
}

fn check_config_semantics(config: &Config, items: &mut Vec<DiagItem>) {
    let cat = "config";

    // Config file exists
    if config.config_path.exists() {
        items.push(DiagItem::ok(
            cat,
            format!("config file: {}", config.config_path.display().to_string()),
        ));

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Run `zeroclaw config migrate` to see the exact parse error for the section
  2. Repair or remove the malformed keys in that section
  3. Re-run `zeroclaw doctor` until no degraded sections are reported

Example fix

# before: typo makes the whole section fail to parse -> reset to defaults
[channel.telegram]
token = "..."

# after: correct section name so your values take effect
[channels.telegram]
token = "..."
Defensive patterns

Strategy: validation

Validate before calling

if zeroclaw doctor | grep -q 'malformed and was reset to defaults'; then
  echo 'a config section is degraded; run zeroclaw config migrate and repair'
  exit 1
fi

Prevention

When it happens

Trigger: A config section fails deserialization at load (wrong types, unknown keys, malformed TOML) and the loader proceeds anyway; `zeroclaw doctor` -> check_degraded_sections lists the section path.

Common situations: Upgrades that change a section's shape while the old file remains; partially edited TOML; sections copied from older docs; the runtime behaving 'as if' config changes had no effect.

Understand the failure class

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/b530846e92d378ef. Report an issue: GitHub.