zed-industries/zed · error
should only be called once
Error message
should only be called once
What it means
Animation element's request_layout expects a one-time take of animation start state (the 'should only be called once' expect): the element's request_layout ran twice without a fresh element state, e.g. the element instance was reused across frames or request_layout is called outside the normal layout/prepaint sequence.
Source
Thrown at crates/gpui/src/elements/animation.rs:344
SpringPlayback::Completed => {
state.spring = SpringState {
position: state.target,
velocity: 0.0,
};
true
}
SpringPlayback::Cancelled => {
state.spring = SpringState {
position: state.initial,
velocity: 0.0,
};
true
}
};
state.playback = self.playback;
state.updated_at = now;
let element = self.element.take().expect("should only be called once");
let animator = self.animator.take().expect("should only be called once");
let mut element = animator(element, state.spring.position).into_any_element();
if !done {
window.request_animation_frame();
}
((element.request_layout(window, cx), element), state)
})
}
fn prepaint(
&mut self,
_id: Option<&GlobalElementId>,
_inspector_id: Option<&InspectorElementId>,
_bounds: crate::Bounds<crate::Pixels>,
element: &mut Self::RequestLayoutState,
window: &mut Window,View on GitHub (pinned to f4178619ac)
Solutions
- Ensure the animation element is used once per frame within the standard element lifecycle
- Don't call request_layout manually or reuse the element struct across renders
- Check that element state initialization happens exactly once before animation starts
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/gpui/src/elements/animation.rs:344 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/e6825eeb8c45cfc1.
Report an issue: GitHub.