{"record":{"id":"3dfb8725617faf87","repo":"jdx/mise","slug":"history-in-is-not-a-table-3dfb87","errorCode":null,"errorMessage":"[history] in {} is not a table","messagePattern":"\\[history\\] in (.+?) is not a table","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/origin.rs","lineNumber":275,"sourceCode":"/// machine names the repository the way it reaches it) and a fresh\n/// machine's own declaration never conflicts with the configuration it\n/// pulls.\nfn origin_file() -> Result<PathBuf> {\n    crate::cli::dotfiles::track::declaration_file(true)\n}\n\n/// Writes the ordinary repository connection.\npub(super) fn write_config(url: &str, branch: &str, mode: Option<SyncMode>) -> Result<()> {\n    let global = origin_file()?;\n    if let Some(parent) = global.parent() {\n        crate::file::create_dir_all(parent)?;\n    }\n    let mut doc = crate::cli::dotfiles::track::read_document(&global)?;\n    let history = doc\n        .entry(\"history\")\n        .or_insert(Item::Table(toml_edit::Table::new()));\n    let Some(history) = history.as_table_mut() else {\n        bail!(\"[history] in {} is not a table\", display_path(&global));\n    };\n    history.set_implicit(true);\n    let origin = history\n        .entry(\"origin\")\n        .or_insert(Item::Table(toml_edit::Table::new()));\n    let Some(origin) = origin.as_table_mut() else {\n        bail!(\n            \"[history.origin] in {} is not a table\",\n            display_path(&global)\n        );\n    };\n    origin.set_implicit(false);\n    origin.insert(\"url\", Item::Value(Value::from(url)));\n    origin.insert(\"branch\", Item::Value(Value::from(branch)));\n    let Some(mode) = mode else {\n        crate::file::write(&global, doc.to_string())?;\n        return Ok(());\n    };","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/sync/origin.rs#L257-L293","documentation":"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.","triggerScenarios":"Thrown at src/system/history/sync/origin.rs:275 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the global config file so [history] is a table","Or delete/rename the malformed file and let mise regenerate it","Re-run the origin set command after correcting the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}