elkowar/eww · error

Error, trying to add multiple children to a…

Error message

Error, trying to add multiple children to a circular-progress widget

What it means

The TransformPriv container (used by widgets like circular-progress) holds at most one child. When `add` is called while a content child already exists, eww logs this error and removes the previous child via `parent_remove` before adding the new one. It prevents silently stacking multiple children on a single-child widget.

Solutions

  1. Ensure the circular-progress/transform widget has exactly one child in your config (wrap multiple elements in a single `box` if needed).
  2. If programmatically adding a new child, remove the old child first (though eww now does this automatically while logging the error).
  3. Check for accidental duplicated child declarations in the widget markup.

Example fix

// before
(circular-progress
  (label :text "a")
  (label :text "b"))
// after
(circular-progress
  (box :orientation "v"
    (label :text "a")
    (label :text "b")))
Defensive patterns

Strategy: validation

Validate before calling

fn validate_single_child(node: &WidgetNode) -> Result<(), String> {
    if node.children.len() > 1 {
        return Err(format!("{} accepts exactly one child, got {}", node.name, node.children.len()));
    }
    Ok(())
}

Prevention

When it happens

Trigger: Calling `add` a second time on a TransformPriv/circular-progress widget that already has a content child; a config declaring more than one child inside a circular-progress widget.

Common situations: eww configs that nest two elements inside `circular-progress`; GTK populating children generically; code reusing the widget and re-adding content.


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

Appendix: source

Thrown at crates/eww/src/widgets/transform.rs:129

}

impl Default for Transform {
    fn default() -> Self {
        Self::new()
    }
}

impl Transform {
    pub fn new() -> Self {
        glib::Object::new::<Self>()
    }
}

impl ContainerImpl for TransformPriv {
    fn add(&self, widget: &gtk::Widget) {
        if let Some(content) = &*self.content.borrow() {
            // TODO: Handle this error when populating children widgets instead
            error_handling_ctx::print_error(anyhow!("Error, trying to add multiple children to a circular-progress widget"));
            self.parent_remove(content);
        }
        self.parent_add(widget);
        self.content.replace(Some(widget.clone()));
    }
}

impl BinImpl for TransformPriv {}
impl WidgetImpl for TransformPriv {
    fn draw(&self, cr: &gtk::cairo::Context) -> glib::Propagation {
        let res: Result<()> = (|| {
            let rotate = *self.rotate.borrow();
            let total_width = self.obj().allocated_width() as f64;
            let total_height = self.obj().allocated_height() as f64;

            cr.save()?;

            let transform_origin_x = match &*self.transform_origin_x.borrow() {

View on GitHub (pinned to 48f5aa8b37)