{"record":{"id":"8979e16f11f50306","repo":"atuinsh/atuin","slug":"empty-theme-directory-override-and-could-not-find","errorCode":null,"errorMessage":"Empty theme directory override and could not find theme elsewhere","messagePattern":"Empty theme directory override and could not find theme elsewhere","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/atuin-client/src/theme.rs","lineNumber":389,"sourceCode":"            loaded_themes: HashMap::new(),\n            debug: debug.unwrap_or(false),\n            override_theme_dir: match theme_dir {\n                Some(theme_dir) => Some(theme_dir),\n                None => std::env::var(\"ATUIN_THEME_DIR\").ok(),\n            },\n        }\n    }\n\n    // Try to load a theme from a `{name}.toml` file in the theme directory. If an override is set\n    // for the theme dir (via ATUIN_THEME_DIR env) we should load the theme from there\n    pub fn load_theme_from_file(\n        &mut self,\n        name: &str,\n        max_depth: u8,\n    ) -> Result<&Theme, Box<dyn error::Error>> {\n        let mut theme_file = if let Some(p) = &self.override_theme_dir {\n            if p.is_empty() {\n                return Err(Box::new(Error::new(\n                    ErrorKind::NotFound,\n                    \"Empty theme directory override and could not find theme elsewhere\",\n                )));\n            }\n            PathBuf::from(p)\n        } else {\n            let config_dir = atuin_common::utils::config_dir();\n            let mut theme_file = if let Ok(p) = std::env::var(\"ATUIN_CONFIG_DIR\") {\n                PathBuf::from(p)\n            } else {\n                let mut theme_file = PathBuf::new();\n                theme_file.push(config_dir);\n                theme_file\n            };\n            theme_file.push(\"themes\");\n            theme_file\n        };\n","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/atuinsh/atuin/blob/900007c48045867e7f44b0f9bc55ad9dbe99ee0d/crates/atuin-client/src/theme.rs#L371-L407","documentation":"When loading a theme, if the user configured an override_theme_dir but the configured string is empty, Atuin cannot resolve the theme file location and immediately returns this NotFound error instead of silently falling back to the default theme search path.","triggerScenarios":"Calling load_theme (-> load_theme_from_file) when the config sets an override theme directory to an empty string, e.g. `theme_dir = \"\"` or an env-derived value that resolved to empty.","commonSituations":"Config templating that yields an empty value (unset env var interpolated as \"\"), a copy-pasted config with the setting blanked, or programmatic construction of a ThemeConfig with the default empty string left in place.","solutions":["Set override_theme_dir to a valid existing directory containing your themes, or remove the override entirely so Atuin uses default search paths.","If the value comes from an env var or template, check it resolves non-empty before writing the config.","Verify the config file (e.g. ~/.config/atuin/config.toml) has a non-empty theme directory value."],"exampleFix":"# before (config.toml)\noverride_theme_dir = \"\"\n\n# after\noverride_theme_dir = \"/home/me/.config/atuin/themes\"","handlingStrategy":"validation","validationCode":"let dir = &settings.theme.override_theme_dir;\nif let Some(d) = dir {\n    if d.is_empty() {\n        eprintln!(\"override_theme_dir is set but empty; fix config.toml or remove it\");\n        std::process::exit(1);\n    }\n    if !std::path::Path::new(d).is_dir() {\n        eprintln!(\"override_theme_dir '{d}' does not exist\");\n    }\n}","typeGuard":"fn has_valid_theme_override(cfg: &Settings) -> bool {\n    cfg.theme\n        .override_theme_dir\n        .as_deref()\n        .map(|d| !d.is_empty())\n        .unwrap_or(true) // no override is fine\n}","tryCatchPattern":"match theme_engine.load_theme(name, 3) {\n    Ok(t) => apply(t),\n    Err(e) if e.to_string().contains(\"Empty theme directory override\") => {\n        eprintln!(\"config: override_theme_dir is empty; falling back to default theme\");\n        apply(default_theme());\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never template override_theme_dir from an env var without a non-empty check","Remove the override key entirely instead of setting it to \"\"","Validate config.toml at startup before building the theme engine"],"tags":["config","theme","not-found"],"backgroundTag":"empty-required-field","analyzedSha":"900007c48045867e7f44b0f9bc55ad9dbe99ee0d","analyzedAt":"2026-09-19T12:52:51.491Z","contentChangedAt":"2026-09-19T12:52:51.491Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}