{"record":{"id":"8af22b1800cc6f9f","repo":"helix-editor/helix","slug":"expected-inherits-to-be-a-string","errorCode":null,"errorMessage":"Expected 'inherits' to be a string: {}","messagePattern":"Expected 'inherits' to be a string: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"helix-view/src/theme.rs","lineNumber":154,"sourceCode":"    /// Recursively load a theme, merging with any inherited parent themes.\n    ///\n    /// The paths that have been visited in the inheritance hierarchy are tracked\n    /// to detect and avoid cycling.\n    ///\n    /// It is possible for one file to inherit from another file with the same name\n    /// so long as the second file is in a themes directory with lower priority.\n    /// However, it is not recommended that users do this as it will make tracing\n    /// errors more difficult.\n    fn load_theme(&self, name: &str, visited_paths: &mut HashSet<PathBuf>) -> Result<Value> {\n        let path = self.path(name, visited_paths)?;\n\n        let theme_toml = self.load_toml(path)?;\n\n        let inherits = theme_toml.get(\"inherits\");\n\n        let theme_toml = if let Some(parent_theme_name) = inherits {\n            let parent_theme_name = parent_theme_name.as_str().ok_or_else(|| {\n                anyhow!(\"Expected 'inherits' to be a string: {}\", parent_theme_name)\n            })?;\n\n            let parent_theme_toml = match parent_theme_name {\n                // load default themes's toml from const.\n                \"default\" => DEFAULT_THEME_DATA.clone(),\n                \"base16_default\" => BASE16_DEFAULT_THEME_DATA.clone(),\n                _ => self.load_theme(parent_theme_name, visited_paths)?,\n            };\n\n            self.merge_themes(parent_theme_toml, theme_toml)\n        } else {\n            theme_toml\n        };\n\n        Ok(theme_toml)\n    }\n\n    pub fn read_names(path: &Path) -> Vec<String> {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-view/src/theme.rs#L136-L172","documentation":"Theme::load_theme reads each theme TOML and, if an 'inherits' key exists, requires it to be a string naming the parent theme; toml Values of other types (array, integer, boolean) fail with \"Expected 'inherits' to be a string: {value}\". The string is then resolved recursively — 'default' and 'base16_default' are built in, anything else loads from the themes directories, with cycle detection via visited_paths.","triggerScenarios":"A theme file containing inherits = [\"default\"] (array), inherits = 1, or inherits = true; YAML-style or copy-paste artifacts around the value; also valid-string cases where the named parent cannot be found surface as the sibling path-resolution error instead.","commonSituations":"Users trying multiple inheritance by listing several parents (unsupported — one string only); machine-generated themes emitting non-string scalars; editing theme files in tooling that auto-quotes or converts values.","solutions":["Make inherits a single string: inherits = \"default\".","To layer multiple customizations, chain single-parent inherits (child inherits parent which inherits grandparent).","Remove the inherits key entirely for a fully self-contained theme."],"exampleFix":"# before (themes/mytheme.toml)\n inherits = [\"default\", \"base16_default\"]\n\n# after\n inherits = \"default\"","handlingStrategy":"validation","validationCode":"fn inherits_is_string(toml: &toml::Value) -> Result<Option<&str>> {\n    match toml.get(\"inherits\") {\n        None => Ok(None),\n        Some(v) => v.as_str().map(Some).ok_or_else(|| anyhow!(\n            \"theme 'inherits' must be a single string, got: {v}\"\n        )),\n    }\n}","typeGuard":"fn inherits_name(theme: &toml::Value) -> Option<&str> {\n    theme.get(\"inherits»).and_then(|v| v.as_str())\n}","tryCatchPattern":"let inherits = match theme_toml.get(\"inherits\") {\n    Some(v) => Some(v.as_str().ok_or_else(|| anyhow!(\"theme {}: 'inherits' must be a string, got {v}\", path.display()))?),\n    None => None,\n};","preventionTips":["Schema-check theme files (type of inherits must be string) before loading.","One parent per theme; chain files for layering instead of arrays.","Validate user themes at startup and report the file path with the bad key."],"tags":["theme","config","toml","helix","rust"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}