{"record":{"id":"39824c44fdcb6945","repo":"elkowar/eww","slug":"configuration-directory-does-not-exist","errorCode":null,"errorMessage":"Configuration directory {} does not exist","messagePattern":"Configuration directory (.+?) does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/paths.rs","lineNumber":26,"sourceCode":"\n/// Stores references to all the paths relevant to eww, and abstracts access to these files and directories\n#[derive(Debug, Clone)]\npub struct EwwPaths {\n    pub log_file: PathBuf,\n    pub log_dir: PathBuf,\n    pub ipc_socket_file: PathBuf,\n    pub config_dir: PathBuf,\n}\n\nimpl EwwPaths {\n    pub fn from_config_dir<P: AsRef<Path>>(config_dir: P) -> Result<Self> {\n        let config_dir = config_dir.as_ref();\n        if config_dir.is_file() {\n            bail!(\"Please provide the path to the config directory, not a file within it\")\n        }\n\n        if !config_dir.exists() {\n            bail!(\"Configuration directory {} does not exist\", config_dir.display());\n        }\n\n        let config_dir = config_dir.canonicalize()?;\n\n        let mut hasher = DefaultHasher::new();\n        format!(\"{}\", config_dir.display()).hash(&mut hasher);\n        // daemon_id is a hash of the config dir path to ensure that, given a normal XDG_RUNTIME_DIR,\n        // the absolute path to the socket stays under the 108 bytes limit. (see #387, man 7 unix)\n        let daemon_id = format!(\"{:x}\", hasher.finish());\n\n        let ipc_socket_file = std::env::var(\"XDG_RUNTIME_DIR\")\n            .map(std::path::PathBuf::from)\n            .unwrap_or_else(|_| std::path::PathBuf::from(\"/tmp\"))\n            .join(format!(\"eww-server_{}\", daemon_id));\n\n        // 100 as the limit isn't quite 108 everywhere (i.e 104 on BSD or mac)\n        if format!(\"{}\", ipc_socket_file.display()).len() > 100 {\n            log::warn!(\"The IPC socket file's absolute path exceeds 100 bytes, the socket may fail to create.\");","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/paths.rs#L8-L44","documentation":"EwwPaths::from_config_dir requires the given config directory to exist on disk. If the path does not exist, it bails with this error before canonicalizing or hashing the directory. This guards against silently operating on a nonexistent config.","triggerScenarios":"Calling EwwPaths::from_config_dir (via --config or the default config location lookup) with a directory path that does not exist — typo'd path, wrong home dir, or config never created.","commonSituations":"Typo in --config argument; running eww under systemd/wayland with a different HOME than expected; fresh machine without eww config; XDG_CONFIG_HOME pointing somewhere unusual.","solutions":["Create the directory: `mkdir -p <path>` and add an eww.yuck file","Correct the --config argument / fix XDG_CONFIG_HOME or HOME so it points where the config actually lives","Log or print config_dir in wrappers to see what path eww is actually resolving","Run `eww state`/inspect EwwPaths default logic to confirm which directory is being used"],"exampleFix":"// before\neww --config ~/.config/ewww open bar   # typo: ewww\n// after\neww --config ~/.config/eww open bar","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nif (!fs.existsSync(configDir)) fs.mkdirSync(configDir, { recursive: true });","typeGuard":"function dirExists(p) { try { return fs.statSync(p).isDirectory(); } catch { return false; } }","tryCatchPattern":"try { ewwPaths(configDir); } catch (e) { if (String(e).includes('does not exist')) { fs.mkdirSync(configDir, { recursive: true }); ewwPaths(configDir); } else { throw e; } }","preventionTips":["Create the config directory before invoking eww","Double-check --config spellings","Verify HOME/XDG_CONFIG_HOME in systemd/autostart environments","Bootstrap configs with eww's example setup on new machines"],"tags":["config","path","directory-not-found"],"backgroundTag":"directory-not-found","analyzedSha":"48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa","analyzedAt":"2026-09-08T03:13:26.897Z","contentChangedAt":"2026-09-08T03:13:26.897Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}