elkowar/eww · error

Please provide the path to the config directory, not a file…

Error message

Please provide the path to the config directory, not a file within it

What it means

EwwPaths::from_config_dir builds the path database for a config directory. If the user passes a file path (e.g. the eww.yuck file itself) instead of the directory containing it, eww rejects it immediately with this message.

Solutions

  1. Pass the config directory, not a file: `eww --config ~/.config/eww open bar`
  2. Strip the filename from the path in any wrapper script (`dirname "$path"`)
  3. Check existing shell aliases/scripts that hardcode the eww.yuck path

Example fix

// before
eww --config ~/.config/eww/eww.yuck open bar
// after
eww --config ~/.config/eww open bar
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
if (fs.statSync(configPath).isFile()) throw new Error('Pass the config DIRECTORY, not a file');

Type guard

function isDirectory(p) { try { return fs.statSync(p).isDirectory(); } catch { return false; } }

Try / catch

try { ewwPaths(configPath); } catch (e) { if (String(e).includes('not a file within it')) { configPath = path.dirname(configPath); ewwPaths(configPath); } else { throw e; } }

Prevention

When it happens

Trigger: Calling EwwPaths::from_config_dir with a path where config_dir.is_file() is true — e.g. `eww --config ~/.config/eww/eww.yuck ...` instead of passing the directory.

Common situations: Users point --config at the yuck file instead of its directory; scripts or wrappers pass $0 or a found file path rather than a directory; docs examples copy-pasted incorrectly.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08). Data as JSON: /api/errors/321c9e3a4fb60872. Report an issue: GitHub.

Appendix: source

Thrown at crates/eww/src/paths.rs:22

    path::{Path, PathBuf},
};

use anyhow::{bail, Result};

/// Stores references to all the paths relevant to eww, and abstracts access to these files and directories
#[derive(Debug, Clone)]
pub struct EwwPaths {
    pub log_file: PathBuf,
    pub log_dir: PathBuf,
    pub ipc_socket_file: PathBuf,
    pub config_dir: PathBuf,
}

impl EwwPaths {
    pub fn from_config_dir<P: AsRef<Path>>(config_dir: P) -> Result<Self> {
        let config_dir = config_dir.as_ref();
        if config_dir.is_file() {
            bail!("Please provide the path to the config directory, not a file within it")
        }

        if !config_dir.exists() {
            bail!("Configuration directory {} does not exist", config_dir.display());
        }

        let config_dir = config_dir.canonicalize()?;

        let mut hasher = DefaultHasher::new();
        format!("{}", config_dir.display()).hash(&mut hasher);
        // daemon_id is a hash of the config dir path to ensure that, given a normal XDG_RUNTIME_DIR,
        // the absolute path to the socket stays under the 108 bytes limit. (see #387, man 7 unix)
        let daemon_id = format!("{:x}", hasher.finish());

        let ipc_socket_file = std::env::var("XDG_RUNTIME_DIR")
            .map(std::path::PathBuf::from)
            .unwrap_or_else(|_| std::path::PathBuf::from("/tmp"))
            .join(format!("eww-server_{}", daemon_id));

View on GitHub (pinned to 48f5aa8b37)