jdx/mise · error

[history] in {} is not a table

Error message

[history] in {} is not a table

What it means

Config-shape guard in origin write_config: while writing the connection settings, the [history] entry in the global config file exists but is not a TOML table (e.g. it is a string or array), so the writer refuses to modify it rather than clobbering user data. Fires on a hand-edited or malformed global config.

Source

Thrown at src/system/history/sync/origin.rs:275

/// machine names the repository the way it reaches it) and a fresh
/// machine's own declaration never conflicts with the configuration it
/// pulls.
fn origin_file() -> Result<PathBuf> {
    crate::cli::dotfiles::track::declaration_file(true)
}

/// Writes the ordinary repository connection.
pub(super) fn write_config(url: &str, branch: &str, mode: Option<SyncMode>) -> Result<()> {
    let global = origin_file()?;
    if let Some(parent) = global.parent() {
        crate::file::create_dir_all(parent)?;
    }
    let mut doc = crate::cli::dotfiles::track::read_document(&global)?;
    let history = doc
        .entry("history")
        .or_insert(Item::Table(toml_edit::Table::new()));
    let Some(history) = history.as_table_mut() else {
        bail!("[history] in {} is not a table", display_path(&global));
    };
    history.set_implicit(true);
    let origin = history
        .entry("origin")
        .or_insert(Item::Table(toml_edit::Table::new()));
    let Some(origin) = origin.as_table_mut() else {
        bail!(
            "[history.origin] in {} is not a table",
            display_path(&global)
        );
    };
    origin.set_implicit(false);
    origin.insert("url", Item::Value(Value::from(url)));
    origin.insert("branch", Item::Value(Value::from(branch)));
    let Some(mode) = mode else {
        crate::file::write(&global, doc.to_string())?;
        return Ok(());
    };

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Fix the global config file so [history] is a table
  2. Or delete/rename the malformed file and let mise regenerate it
  3. Re-run the origin set command after correcting the file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/system/history/sync/origin.rs:275 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/3dfb8725617faf87. Report an issue: GitHub.