{"record":{"id":"ad81d2d309cb02ce","repo":"jdx/mise","slug":"settings-in-is-not-a-table","errorCode":null,"errorMessage":"[settings] in {} is not a table","messagePattern":"\\[settings\\] in (.+?) is not a table","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/origin.rs","lineNumber":363,"sourceCode":"        .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    };\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.","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/origin.rs#L345-L381","documentation":"Thrown by write_config in the history sync origin code when the global mise config file contains a `[settings]` key whose value is not a TOML table (e.g. a string, integer, or array). The code needs to mutate `settings.history.sync` inside that table, so it cannot proceed when the entry is a different TOML type.","triggerScenarios":"Calling `mise dot origin set` (set_inner -> write_config) when the user's global config.toml defines `settings` as a non-table value, such as `settings = \"foo\"` or `settings = 1`.","commonSituations":"A hand-edited global config with a typo like `settings=\"readonly\"` instead of `[settings]`; a templating/scripting mistake that wrote a scalar under settings; a corrupted config from a bad merge.","solutions":["Open the global config file shown in the error and change `settings` to a proper TOML table: `[settings]` with key/value lines underneath","Remove the scalar `settings` line entirely if it was unintended and re-run the command","Run `mise doctor` to verify the config parses cleanly afterward"],"exampleFix":"// before (global config.toml)\nsettings = \"readonly\"\n// after\n[settings]\nexperimental = true","handlingStrategy":"validation","validationCode":"let doc = std::fs::read_to_string(&config_path)?;\nlet parsed: toml::Table = doc.parse()?;\nif !matches!(parsed.get(\"settings\"), Some(toml::Value::Table(_))) {\n    eprintln!(\"fix [settings] in {} to be a table first\", config_path.display());\n    return Ok(());\n}","typeGuard":"fn settings_is_table(doc: &toml::Table) -> bool {\n    matches!(doc.get(\"settings\"), Some(toml::Value::Table(_)))\n}","tryCatchPattern":null,"preventionTips":["Always edit the global config with proper TOML table syntax ([settings]) rather than scalar assignments","Run `mise doctor` after hand-editing config files","Use `mise settings set <key> <value>` instead of manual edits"],"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"}