elkowar/eww · error
Error, Graph widget shoudln't have any children
Error message
Error, Graph widget shoudln't have any children
What it means
Eww's Graph widget is implemented as a GTK container only to satisfy GTK's widget protocol, but it draws its values itself and must never receive child widgets. When GTK (or user code) calls `add` on the Graph container, eww immediately routes the call into the error-handling context instead of accepting the child. This is an internal-invariant guard against a structurally invalid widget tree.
Solutions
- Remove any child widgets nested inside the `graph` element in your eww config; graph takes only its `value` attribute.
- If writing Rust code against the widget, do not call `.add()` on a Graph instance.
- Feed the graph data via its `:value` attribute / script var instead of child widgets.
Example fix
// before (graph :value x (box :orientation "h" (label :text "hi"))) // after (graph :value x)
Defensive patterns
Strategy: validation
Validate before calling
fn validate_graph_config(node: &WidgetNode) -> Result<(), String> {
if !node.children.is_empty() {
return Err("graph widget must not have children; use the `value` attribute instead".into());
}
Ok(())
} Prevention
- Never nest elements inside `(graph ...)` in eww configs.
- Feed data via `:value` / script vars, not child widgets.
- Add a config linter check rejecting children on leaf widgets.
When it happens
Trigger: Calling `add` (or `ContainerExt::add`) on a GraphPriv/Graph widget instance; a config nesting children inside a `graph` widget declaration.
Common situations: Users write eww config XML/YAML that places a child (text, box, etc.) inside a `graph` widget; library code that generically adds children to all containers.
AI-assisted analysis of elkowar/eww@48f5aa8b37 (2026-09-08).
Data as JSON: /api/errors/dc0d31254405fc8f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/eww/src/widgets/graph.rs:177
klass.set_css_name("graph");
}
}
impl Default for Graph {
fn default() -> Self {
Self::new()
}
}
impl Graph {
pub fn new() -> Self {
glib::Object::new::<Self>()
}
}
impl ContainerImpl for GraphPriv {
fn add(&self, _widget: >k::Widget) {
error_handling_ctx::print_error(anyhow!("Error, Graph widget shoudln't have any children"));
}
}
impl BinImpl for GraphPriv {}
impl WidgetImpl for GraphPriv {
fn preferred_width(&self) -> (i32, i32) {
let thickness = *self.thickness.borrow() as i32;
(thickness, thickness)
}
fn preferred_width_for_height(&self, height: i32) -> (i32, i32) {
(height, height)
}
fn preferred_height(&self) -> (i32, i32) {
let thickness = *self.thickness.borrow() as i32;
(thickness, thickness)
}View on GitHub (pinned to 48f5aa8b37)