a-b-street/abstreet · error

Can't scroll_to_member of unknown

Error message

Can't scroll_to_member of unknown {}

What it means

Panel::scroll_to_member scrolls the panel so the widget with the given ID is visible. This fires when no widget in the panel's top_level tree has that name — the caller passed an ID that was never added, was renamed, or belonged to a previous panel layout. It is a programming-error guard for UI code.

Solutions

  1. Check `panel.has_widget(&name)` before calling scroll_to_member
  2. Ensure the widget was named with `.named(name)` and not removed by take/replace
  3. Fix the name typo or move the widget into this Panel
  4. Re-scan after layout changes since replacement changes the tree

Example fix

// before
panel.scroll_to_member(ctx, "summary_row".to_string());
// after
if panel.has_widget("summary_row") {
    panel.scroll_to_member(ctx, "summary_row".to_string());
}
Defensive patterns

Strategy: validation

Validate before calling

if panel.has_widget(&name) {
    panel.scroll_to_member(ctx, name);
}

Prevention

When it happens

Trigger: Calling `panel.scroll_to_member(ctx, name)` where `name` was never assigned via `.named(...)` or was removed/replaced (e.g. after swap_inner_content or replace).

Common situations: Typo in the widget name; widget lives in a different Panel; the widget was taken out or replaced between calls.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13). Data as JSON: /api/errors/e26ae5bcd1b5a1d1. Report an issue: GitHub.

Appendix: source

Thrown at widgetry/src/widgets/panel.rs:388

pub fn scroll_to_member(&mut self, ctx: &EventCtx, name: String) {
    if let Some(w) = self.top_level.find(&name) {
        let y1 = w.rect.y1;
        self.set_scroll_offset(ctx, (0.0, y1));
    } else {
        panic!("Can't scroll_to_member of unknown {}", name);
    }
}

View on GitHub (pinned to 0964f29315)