{"record":{"id":"e6825eeb8c45cfc1","repo":"zed-industries/zed","slug":"should-only-be-called-once","errorCode":null,"errorMessage":"should only be called once","messagePattern":"should only be called once","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/elements/animation.rs","lineNumber":344,"sourceCode":"                SpringPlayback::Completed => {\n                    state.spring = SpringState {\n                        position: state.target,\n                        velocity: 0.0,\n                    };\n                    true\n                }\n                SpringPlayback::Cancelled => {\n                    state.spring = SpringState {\n                        position: state.initial,\n                        velocity: 0.0,\n                    };\n                    true\n                }\n            };\n            state.playback = self.playback;\n            state.updated_at = now;\n\n            let element = self.element.take().expect(\"should only be called once\");\n            let animator = self.animator.take().expect(\"should only be called once\");\n            let mut element = animator(element, state.spring.position).into_any_element();\n\n            if !done {\n                window.request_animation_frame();\n            }\n\n            ((element.request_layout(window, cx), element), state)\n        })\n    }\n\n    fn prepaint(\n        &mut self,\n        _id: Option<&GlobalElementId>,\n        _inspector_id: Option<&InspectorElementId>,\n        _bounds: crate::Bounds<crate::Pixels>,\n        element: &mut Self::RequestLayoutState,\n        window: &mut Window,","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui/src/elements/animation.rs#L326-L362","documentation":"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.","triggerScenarios":"Thrown at crates/gpui/src/elements/animation.rs:344 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}