elkowar/eww · error
Error, missing argument
Error message
Error, missing argument '{}' when creating window with id '{}' What it means
WindowArguments::get_local_window_variables checks that every non-optional argument declared in the window definition (expected_args) is present among the provided local variables/args. If a required argument is missing when creating a window instance, eww bails with this error naming the argument and window id.
Solutions
- Supply the missing argument: `eww open <window> <arg>=<value>`
- Mark the argument optional in the window definition if it is not truly required
- Use `eww windows` to inspect the window's expected args and what you passed
- Update scripts/autostart configs that open the window to pass all required args
Example fix
// before eww open bar // after eww open bar idx=0 monitor=1
Defensive patterns
Strategy: validation
Validate before calling
const required = windowDef.expectedArgs.filter(a => !a.optional);
const missing = required.filter(a => !(a.name in providedArgs));
if (missing.length) throw new Error(`missing: ${missing.map(a => a.name).join(', ')}`); Type guard
function hasRequiredArgs(def, args) { return def.expectedArgs.every(a => a.optional || a.name in args); } Try / catch
try { execSync(`eww open ${win} ${args}`); } catch (e) { if (String(e).includes("missing argument")) { console.error('Supply all required window args, e.g. eww open bar idx=0'); } else { throw e; } } Prevention
- Pass every non-optional expected arg on `eww open`
- Mark truly optional params with optional in the window definition
- Inspect `eww windows` to see declared expected args
- Keep autostart/open scripts in sync with window definitions
When it happens
Trigger: Running `eww open <window>` where the window's (defwindow ... expected-args) declares a required attribute that was not supplied — e.g. `eww open bar foo=1` omitting a required arg like `:expected-args "{idx}"` with no idx given.
Common situations: Windows defined with :expected-args but opened without `eww open window key=value`; widget repetition helpers (windows opened per monitor/workspace) missing the monitor/workspace argument; renamed arguments not updated in the open command.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- variables unexpectedly defined when creating window with id
- Please provide the path to the config directory, not a file…
- scope inherited variable that parent scope doesn't have…
- inheritance_relations values lists scope that is not in…
- This widget can only be used as a child of some container…
AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08).
Data as JSON: /api/errors/7dad8939a649f97b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/eww/src/window_arguments.rs:75
let expected_args: HashSet<&String> = window_def.expected_args.iter().map(|x| &x.name.0).collect();
let mut local_variables: HashMap<VarName, DynVal> = HashMap::new();
// Ensure that the arguments passed to the window that are already interpreted by eww (id, screen)
// are set to the correct values
if expected_args.contains(&String::from("id")) {
local_variables.insert(VarName::from("id"), DynVal::from(self.instance_id.clone()));
}
if self.monitor.is_some() && expected_args.contains(&String::from("screen")) {
let mon_dyn = DynVal::from(&self.monitor.clone().unwrap());
local_variables.insert(VarName::from("screen"), mon_dyn);
}
local_variables.extend(self.args.clone());
for attr in &window_def.expected_args {
let name = VarName::from(attr.name.clone());
if !local_variables.contains_key(&name) && !attr.optional {
bail!("Error, missing argument '{}' when creating window with id '{}'", attr.name, self.instance_id);
}
}
if local_variables.len() != window_def.expected_args.len() {
let unexpected_vars: Vec<_> = local_variables.keys().filter(|&n| !expected_args.contains(&n.0)).cloned().collect();
bail!(
"variables {} unexpectedly defined when creating window with id '{}'",
unexpected_vars.join(", "),
self.instance_id,
);
}
Ok(local_variables)
}
}
View on GitHub (pinned to 48f5aa8b37)