{"record":{"id":"dc0d31254405fc8f","repo":"elkowar/eww","slug":"error-graph-widget-shoudln-t-have-any-children","errorCode":null,"errorMessage":"Error, Graph widget shoudln't have any children","messagePattern":"Error, Graph widget shoudln't have any children","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/widgets/graph.rs","lineNumber":177,"sourceCode":"        klass.set_css_name(\"graph\");\n    }\n}\n\nimpl Default for Graph {\n    fn default() -> Self {\n        Self::new()\n    }\n}\n\nimpl Graph {\n    pub fn new() -> Self {\n        glib::Object::new::<Self>()\n    }\n}\n\nimpl ContainerImpl for GraphPriv {\n    fn add(&self, _widget: &gtk::Widget) {\n        error_handling_ctx::print_error(anyhow!(\"Error, Graph widget shoudln't have any children\"));\n    }\n}\n\nimpl BinImpl for GraphPriv {}\nimpl WidgetImpl for GraphPriv {\n    fn preferred_width(&self) -> (i32, i32) {\n        let thickness = *self.thickness.borrow() as i32;\n        (thickness, thickness)\n    }\n\n    fn preferred_width_for_height(&self, height: i32) -> (i32, i32) {\n        (height, height)\n    }\n\n    fn preferred_height(&self) -> (i32, i32) {\n        let thickness = *self.thickness.borrow() as i32;\n        (thickness, thickness)\n    }","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/widgets/graph.rs#L159-L195","documentation":"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.","triggerScenarios":"Calling `add` (or `ContainerExt::add`) on a GraphPriv/Graph widget instance; a config nesting children inside a `graph` widget declaration.","commonSituations":"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.","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."],"exampleFix":"// before\n(graph :value x\n  (box :orientation \"h\" (label :text \"hi\")))\n// after\n(graph :value x)","handlingStrategy":"validation","validationCode":"fn validate_graph_config(node: &WidgetNode) -> Result<(), String> {\n    if !node.children.is_empty() {\n        return Err(\"graph widget must not have children; use the `value` attribute instead\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":[],"backgroundTag":null,"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"}