{"record":{"id":"d16ab1eba99d219e","repo":"helix-editor/helix","slug":"failed-to-load-config","errorCode":null,"errorMessage":"Failed to load config: {}","messagePattern":"Failed to load config: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"helix-term/src/application.rs","lineNumber":420,"sourceCode":"            }\n        }\n\n        // Update all the relevant members in the editor after updating\n        // the configuration.\n        self.editor.refresh_config(&old_editor_config);\n\n        // reset view position in case softwrap was enabled/disabled\n        let scrolloff = self.editor.config().scrolloff;\n        for (view, _) in self.editor.tree.views() {\n            let doc = doc_mut!(self.editor, &view.doc);\n            view.ensure_cursor_in_view(doc, scrolloff);\n        }\n    }\n\n    fn refresh_config(&mut self) {\n        let mut refresh_config = || -> Result<(), Error> {\n            let default_config = Config::load_default()\n                .map_err(|err| anyhow::anyhow!(\"Failed to load config: {}\", err))?;\n\n            // Apply any change to editor.workspace_trust before reading local language config.\n            self.editor\n                .workspace_trust\n                .set_config((&default_config.editor.workspace_trust).into());\n\n            // Update the syntax language loader before setting the theme. Setting the theme will\n            // call `Loader::set_scopes` which must be done before the documents are re-parsed for\n            // the sake of locals highlighting.\n            let lang_loader = helix_core::config::user_lang_loader(&self.editor.workspace_trust)?;\n            self.editor.syn_loader.store(Arc::new(lang_loader));\n            Self::load_configured_theme(\n                &mut self.editor,\n                &default_config,\n                &mut self.terminal,\n                self.theme_mode,\n            );\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-term/src/application.rs#L402-L438","documentation":"Runtime config reload (refresh_config, used by :config-refresh) failed to load the default config: Config::load_default() errored (TOML parse error, wrong types, or unreadable config.toml) and the anyhow context 'Failed to load config: {}' wraps the underlying toml error including its span/line info.","triggerScenarios":"Editing config.toml and running ':config-refresh' (or triggering a reload) while the file has a syntax error, a duplicated key, or a value of the wrong type (e.g. scrolloff = \"5\" instead of an integer). The inner error string contains the TOML error with line/column.","commonSituations":"Live-editing config and refreshing without validating; merging snippets from docs with different types across a Helix upgrade (config keys renamed/retyped in newer versions); stray quotes/brackets; accidentally saving a partial write.","solutions":["Read the inner error: the toml message pinpoints line and column of the invalid entry - fix config.toml at that location","Validate quickly: 'hx --health' also loads config and reports errors, or run a TOML linter / 'tomlq .' on config.toml","After a Helix upgrade, diff your config against the current default config.toml / docs for renamed or retyped keys","Once fixed, re-run ':config-refresh' or restart hx"],"exampleFix":"# before (config.toml) - string where int expected\nscrolloff = \"5\"\n\n# after\nscrolloff = 5","handlingStrategy":"try-catch","validationCode":"# Validate TOML after every edit, before refreshing inside hx:\ntomlq '.' ~/.config/helix/config.toml > /dev/null && echo config-ok","typeGuard":null,"tryCatchPattern":"// refresh_config already returns Result and is surfaced by :config-refresh;\n// in your own code keep the old config on failure (Helix does this - it maps\n// the error and keeps running with the previous config):\nif let Err(e) = app.refresh_config() {\n    editor.set_error(format!(\"{e:#}\")); // old config stays active\n}","preventionTips":["Run 'hx --health' after editing config - it loads config and reports parse errors with line numbers","Use an editor with TOML schema/lint support for config.toml","Re-check renamed/retyped keys after upgrading Helix before reloading"],"tags":["rust","helix","config","toml","config-refresh"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}