elkowar/eww · error
OneToNElementsMap got into inconsistent state
Error message
OneToNElementsMap got into inconsistent state
What it means
An internal invariant check in OneToNElementsMap: parent_to_children listed a child index that has no entry in child_to_parent. The two maps must always agree, so this panic indicates a corrupted internal state — a bug in the map's insert/remove logic, not bad user input.
Solutions
- Reproduce with the offending config and file a bug report with the config snippet — this is an internal invariant violation in eww's scope bookkeeping.
- Work around by fully restarting the daemon (`eww kill && eww daemon`) instead of hot-reloading the dynamic config.
- Update eww to the latest version in case the insert/remove inconsistency was already fixed.
- Simplify the config: avoid widgets/for_each constructs that churn scope identities on every reload to reduce exposure.
Defensive patterns
Strategy: validation
Validate before calling
// sanity-check the map before querying assert!(parent_to_children.keys().all(|c| child_to_parent.contains_key(c)), "map out of sync");
Try / catch
// this is an unrecoverable internal invariant; catch_unwind around config reload keeps the daemon alive let r = std::panic::catch_unwind(AssertUnwindSafe(|| graph.get_children_edges_of(idx)));
Prevention
- Keep parent_to_children and child_to_parent mutations paired in a single method
- Write property tests asserting the two maps mirror each other after insert/remove
- Avoid rapid config reloads on broken configs until the bug is fixed
- Report the triggering config upstream
When it happens
Trigger: Calling get_children_edges_of(index) after a sequence of operations that removed a child's parent entry (or inserted the child into parent_to_children without a matching child_to_parent entry), e.g. during scope-graph rebuilds on config reload.
Common situations: Hit while reloading eww configs with dynamic scopes (for_each/windows), typically during rapid config reloads or hot-reload races that partially tear down scope mappings.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- No root scope in graph
- Error opening log file
- Something went wrong unindenting the string
- Could not get default gtk theme
- no pixbuf from theme.load_icon despite no error
AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08).
Data as JSON: /api/errors/09e804a2deb069d4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/eww/src/state/one_to_n_elements_map.rs:65
pub fn get_parent_edge_of(&self, index: I) -> Option<&(I, T)> {
self.child_to_parent.get(&index)
}
pub fn get_parent_edge_mut(&mut self, index: I) -> Option<&mut (I, T)> {
self.child_to_parent.get_mut(&index)
}
#[allow(unused)]
pub fn get_children_of(&self, index: I) -> HashSet<I> {
self.parent_to_children.get(&index).cloned().unwrap_or_default()
}
/// Return the children and edges to those children of a given scope
pub fn get_children_edges_of(&self, index: I) -> Vec<(I, &T)> {
let mut result = Vec::new();
if let Some(children) = self.parent_to_children.get(&index) {
for child_scope in children {
let (_, edge) = self.child_to_parent.get(child_scope).expect("OneToNElementsMap got into inconsistent state");
result.push((*child_scope, edge));
}
}
result
}
#[cfg_attr(not(debug_assertions), allow(dead_code))]
pub fn validate(&self) -> Result<()> {
for (parent, children) in &self.parent_to_children {
for child in children {
if let Some((parent_2, _)) = self.child_to_parent.get(child) {
if parent_2 != parent {
bail!(
"parent_to_child stored mapping from {:?} to {:?}, but child_to_parent contained mapping to {:?} \
instead",
parent,
child,
parent_2View on GitHub (pinned to 48f5aa8b37)