{"record":{"id":"f6c6b6fe0a817165","repo":"jdx/mise","slug":"settings-history-in-is-not-a-table","errorCode":null,"errorMessage":"[settings.history] in {} is not a table","messagePattern":"\\[settings\\.history\\] in (.+?) is not a table","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/origin.rs","lineNumber":370,"sourceCode":"    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    };\n    let settings = doc\n        .entry(\"settings\")\n        .or_insert(Item::Table(toml_edit::Table::new()));\n    let Some(settings) = settings.as_table_mut() else {\n        bail!(\"[settings] in {} is not a table\", display_path(&global));\n    };\n    settings.set_implicit(true);\n    let history_settings = settings\n        .entry(\"history\")\n        .or_insert(Item::Table(toml_edit::Table::new()));\n    let Some(history_settings) = history_settings.as_table_mut() else {\n        bail!(\n            \"[settings.history] in {} is not a table\",\n            display_path(&global)\n        );\n    };\n    history_settings.set_implicit(false);\n    history_settings.insert(\"sync\", Item::Value(Value::from(mode.as_str())));\n    crate::file::write(&global, doc.to_string())?;\n    Ok(())\n}\n\n/// Offer enrollment explicitly; connecting origin must not enroll prerequisites.\nasync fn setup_requirements(tracked: &TrackedSet) -> Result<()> {\n    use crate::system::files::FileMode;\n    let config = crate::config::Config::get().await?;\n    let mut required = std::collections::BTreeSet::new();\n    let shared_config = crate::config::global_shared_config_path();\n    if shared_config.is_file() {\n        required.insert(shared_config);","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/origin.rs#L352-L388","documentation":"Thrown by write_config when the global config's `[settings]` table exists but its `history` key is not a table. write_config must set `history.sync` under it, so a scalar or array at `settings.history` blocks the update.","triggerScenarios":"Running `mise dot origin set` when the global config contains e.g. `settings.history = \"off\"` or `[settings]` `history = 3`.","commonSituations":"Manually adding a `history` key under `[settings]` as a scalar; a stale or hand-merged config where history sync options were flattened.","solutions":["Edit the global config and replace the scalar `history` value under `[settings]` with a table: `[settings.history]` containing `sync = \"...\"` or remove it","Remove the invalid `history` key and let `mise dot origin set` create the table itself","Validate the file with a TOML parser or `mise doctor` before retrying"],"exampleFix":"// before\n[settings]\nhistory = \"off\"\n// after\n[settings.history]\nsync = \"disabled\"","handlingStrategy":"validation","validationCode":"let doc: toml::Table = std::fs::read_to_string(&config_path)?.parse()?;\nlet bad = doc.get(\"settings\")\n    .and_then(|s| s.get(\"history\"))\n    .map(|h| !h.is_table())\n    .unwrap_or(false);\nif bad { eprintln!(\"settings.history must be a table in {}\"); }","typeGuard":"fn history_is_table(settings: &toml::Table) -> bool {\n    matches!(settings.get(\"history\"), Some(toml::Value::Table(_)))\n}","tryCatchPattern":null,"preventionTips":["Use `mise settings` commands to manage nested settings instead of editing by hand","Keep [settings.history] as its own table section, never a scalar under [settings]","Lint config files with a TOML parser before committing them"],"tags":["toml","config","history-sync"],"backgroundTag":"config-type-mismatch","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}