#3461·iced

keyed::Column::from_vecs accepts mismatched keys and children and later panics during reconciliation

Author: cuishuangCreated Sep 10, 2026Updated Sep 10, 2026
Labelsbug

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

keyed::Column::from_vecs accepts vectors with different lengths:

rust
let column = keyed::Column::from_vecs(
    vec![],
    vec![text("hello").into()],
);

This creates a column with one child but no corresponding key.

Tree::new initially stores an empty State::keys. During the first reconciliation, diff_children_custom_with_search creates the child state and returns without invoking maybe_changed.

During the next reconciliation, current_children contains one entry while state.keys is still empty. The maybe_changed(0) callback then evaluates state.keys[0], causing an out-of-bounds panic.

The constructor does not document or enforce that keys.len() must equal children.len().

What is the expected behavior?

keyed::Column::from_vecs should reject mismatched vector lengths immediately with a clear error instead of creating invalid state that panics later during widget reconciliation.

Version

master

Operating System

macOS

Do you have any log output?

bash
index out of bounds: the len is 0 but the index is 0