Hmbown/CodeWhale · error

Create lookups always yield a table

Error message

Create lookups always yield a table

What it means

Internal invariant in set_config_document_value's table traversal: a lookup performed with PathLookup::Create was expected to always produce a table-like entry, but it did not — indicates corrupted document structure or a bug, not user input.

Source

Thrown at crates/config/src/config_document.rs:121

                crate::quote_os_path(path)
            );
        }
        persist_locked(path, current.as_deref(), body.as_bytes())
    })
}

/// Set a value at `segments`, creating implicit parent tables while preserving
/// existing key/value decor.
pub fn set_config_document_value(
    doc: &mut toml_edit::DocumentMut,
    segments: &[&str],
    value: impl Into<toml_edit::Value>,
) -> Result<()> {
    let (key, parents) = segments
        .split_last()
        .context("config value path must not be empty")?;
    let table = table_like_at_path_mut(doc.as_table_mut(), parents, PathLookup::Create)?
        .expect("Create lookups always yield a table");
    match table.get_mut(key) {
        Some(item) => {
            let mut value = value.into();
            if let Some(existing) = item.as_value() {
                *value.decor_mut() = existing.decor().clone();
            }
            *item = toml_edit::Item::Value(value);
        }
        None => {
            table.insert(key, toml_edit::value(value));
        }
    }
    Ok(())
}

/// Remove a value at `segments` without disturbing unrelated tables or decor.
pub fn unset_config_document_value(
    doc: &mut toml_edit::DocumentMut,

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. This should not occur in normal use; report it as a bug with the config path and value being set
  2. Regenerate or hand-fix the affected config file as a workaround
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/config/src/config_document.rs:121 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/a2d8af989e386eeb. Report an issue: GitHub.