{"record":{"id":"5f5fc57edc077b95","repo":"DioxusLabs/dioxus","slug":"lazy-value-is-not-initialized-make-sure-to-call","errorCode":null,"errorMessage":"Lazy value is not initialized. Make sure to call `initialize` before dereferencing.","messagePattern":"Lazy value is not initialized\\. Make sure to call `initialize` before dereferencing\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/fullstack/src/lazy.rs","lineNumber":98,"sourceCode":"            if self\n                .started_initialization\n                .swap(true, std::sync::atomic::Ordering::SeqCst)\n            {\n                self.value.wait();\n                return Ok(());\n            }\n\n            // Otherwise, we need to initialize the value\n            self.set(constructor().unwrap())?;\n        }\n        Ok(())\n    }\n\n    /// Get a reference to the value of the `Lazy` instance. This will block the current thread if the\n    /// value is not yet initialized.\n    pub fn get(&self) -> &T {\n        if self.constructor.is_none() {\n            return self.value.get().expect(\"Lazy value is not initialized. Make sure to call `initialize` before dereferencing.\");\n        };\n\n        if self.value.get().is_none() {\n            self.initialize().expect(\"Failed to initialize lazy value\");\n        }\n\n        self.value.get().unwrap()\n    }\n}\n\nimpl<T: Send + Sync + 'static> Default for Lazy<T> {\n    fn default() -> Self {\n        Self::lazy()\n    }\n}\n\nimpl<T: Send + Sync + 'static> std::ops::Deref for Lazy<T> {\n    type Target = T;","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/fullstack/src/lazy.rs#L80-L116","documentation":"Lazy::get was called before the Lazy value was initialized and no constructor is available to initialize it on demand. The API contract requires calling `initialize` (or constructing with a constructor) before dereferencing.","triggerScenarios":"Thrown at packages/fullstack/src/lazy.rs:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call `initialize` on the lazy value before dereferencing it, or use the accessor that initializes it on first use."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}