jdx/mise · error

[history.origin] in is not a table

Error message

[history.origin] in {} is not a table

What it means

Within `[history]`, `write_config` needs a `[history.origin]` sub-table to store the sync origin URL and mode. If `history.origin` exists but holds a non-table value, mise bails instead of clobbering it.

Solutions

  1. Edit the global config so origin is a sub-table: `[history.origin]` with `url = "..."`, or delete the `origin` key and retry
  2. Remove the scalar `origin` key under `[history]` and re-run `mise dot origin set`
  3. Validate the global config's TOML structure before re-running

Example fix

// before
[history]
origin = "git@github.com:user/repo.git"
// after
[history.origin]
url = "git@github.com:user/repo.git"
Defensive patterns

Strategy: validation

Validate before calling

// verify [history.origin] is a table before connecting
let doc = global.parse::<toml::Table>()?;
if let Some(o) = doc.get("history").and_then(|h| h.get("origin")) && !o.is_table() {
    eprintln!("fix [history.origin] in the global config: it must be a table");
}

Try / catch

match result {
    Err(e) if e.to_string().contains("[history.origin] is not a table") => {
        eprintln!("rewrite history.origin as a [history.origin] table, then retry");
    }
    _ => {}
}

Prevention

When it happens

Trigger: set_inner -> write_config: after inserting `[history]`, the existing `origin` entry inside it is not a table, so `as_table_mut()` returns None.

Common situations: Hand-edited config with `origin = "git@..."` (scalar) under `[history]` instead of `[history.origin]`; a settings-style `history.origin` string value written by an older version or another tool.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/1c0be4964939c570. Report an issue: GitHub.

Appendix: source

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

/// 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(());
    };
    let settings = doc
        .entry("settings")
        .or_insert(Item::Table(toml_edit::Table::new()));
    let Some(settings) = settings.as_table_mut() else {
        bail!("[settings] in {} is not a table", display_path(&global));
    };
    settings.set_implicit(true);

View on GitHub (pinned to 533346cc37)