{"record":{"id":"b9d20463dd62e603","repo":"helix-editor/helix","slug":"could-not-load-theme","errorCode":null,"errorMessage":"Could not load theme: {}","messagePattern":"Could not load theme: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helix-term/src/commands/typed.rs","lineNumber":1133,"sourceCode":"            if args.is_empty() {\n                // Ensures that a preview theme gets cleaned up if the user backspaces until the prompt is empty.\n                cx.editor.unset_theme_preview()?;\n            } else if let Some(theme_name) = args.first() {\n                if let Ok(theme) = cx.editor.theme_loader.load(theme_name) {\n                    if !(true_color || theme.is_16_color()) {\n                        bail!(\"Unsupported theme: theme requires true color support\");\n                    }\n                    cx.editor.set_theme_preview(theme)?;\n                };\n            };\n        }\n        PromptEvent::Validate => {\n            if let Some(theme_name) = args.first() {\n                let theme = cx\n                    .editor\n                    .theme_loader\n                    .load(theme_name)\n                    .map_err(|err| anyhow::anyhow!(\"Could not load theme: {}\", err))?;\n                if !(true_color || theme.is_16_color()) {\n                    bail!(\"Unsupported theme: theme requires true color support\");\n                }\n                cx.editor.set_theme(theme)?;\n            } else {\n                let name = cx.editor.theme.name().to_string();\n\n                cx.editor.set_status(name);\n            }\n        }\n    };\n\n    Ok(())\n}\n\nfn yank_main_selection_to_clipboard(\n    cx: &mut compositor::Context,\n    _args: Args,","sourceCodeStart":1115,"sourceCodeEnd":1151,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-term/src/commands/typed.rs#L1115-L1151","documentation":"`:theme <name>` asks Editor::theme_loader to find and parse a theme file (built-in themes or the user themes directory). A missing name or a TOML parse/theme-definition failure is wrapped as 'Could not load theme: <err>'. It runs on PromptEvent::Validate (when the prompt is submitted); preview-time load failures use a different path that shows the theme name instead.","triggerScenarios":"`:theme nonexistent-name`; a custom theme in ~/.config/helix/themes with invalid TOML or invalid keys; `inherits = \"...\"` pointing at a theme that does not exist or itself fails to load.","commonSituations":"Typos in theme names; custom themes broken by helix upgrades that changed theme keys; themes whose inherit parent is missing; editing a theme file and re-selecting it.","solutions":["Retry with a known-good built-in name (e.g. `:theme default`) to confirm the loader itself works.","For custom themes, fix the TOML per the reported parse error and re-run `:theme <name>` — files are re-read on each invocation, no restart needed.","Ensure the file lives in the user themes directory (~/.config/helix/themes/<name>.toml) and that `inherits` names an existing theme."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before switching, confirm the theme file exists where the loader looks\nlet p = user_themes_dir.join(format!(\"{name}.toml\"));\nif !p.exists() && !builtin_names.contains(name) { /* pick another name */ }","typeGuard":null,"tryCatchPattern":"match cx.editor.theme_loader.load(theme_name) {\n    Ok(theme) => cx.editor.set_theme_preview(theme)?,\n    Err(err) => cx.editor.set_error(format!(\"Could not load theme: {err}\")), // keep current theme\n}","preventionTips":["Validate custom themes by loading them once after every edit; errors surface immediately.","Keep `inherits` parents present, and re-test themes after helix upgrades change theme keys."],"tags":["theme","config","toml"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}