{"record":{"id":"1011774cb9c379cb","repo":"DioxusLabs/dioxus","slug":"tried-to-access-err-on-an-ok-value","errorCode":null,"errorMessage":"Tried to access `err` on an Ok value","messagePattern":"Tried to access `err` on an Ok value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/stores/src/impls/result.rs","lineNumber":127,"sourceCode":"    /// only track the shallow state of the `Result`. It will only cause a re-run if the `Result` could\n    /// change from `Ok` to `Err` or vice versa.\n    ///\n    /// # Example\n    /// ```rust, no_run\n    /// use dioxus_stores::*;\n    /// let store = use_store(|| Err::<(), u32>(42));\n    /// match store.err() {\n    ///     Some(err_store) => assert_eq!(err_store(), 42),\n    ///     None => panic!(\"Expected Err\"),\n    /// }\n    /// ```\n    pub fn err(self) -> Option<MappedStore<E, Lens>>\n    where\n        Lens: Writable<Target = Result<T, E>> + 'static,\n    {\n        self.is_err().then(|| {\n            let map: fn(&Result<T, E>) -> &E = |value| match value {\n                Ok(_) => panic!(\"Tried to access `err` on an Ok value\"),\n                Err(e) => e,\n            };\n            let map_mut: fn(&mut Result<T, E>) -> &mut E = |value| match value {\n                Ok(_) => panic!(\"Tried to access `err` on an Ok value\"),\n                Err(e) => e,\n            };\n            self.into_selector().child(1, map, map_mut).into()\n        })\n    }\n\n    /// Transposes the `Store<Result<T, E>>` into a `Result<Store<T>, Store<E>>`. This will only track the\n    /// shallow state of the `Result`. It will only cause a re-run if the `Result` could change from `Err` to\n    /// `Ok` or vice versa.\n    ///\n    /// # Example\n    /// ```rust, no_run\n    /// use dioxus_stores::*;\n    /// let store = use_store(|| Ok::<u32, ()>(42));","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/stores/src/impls/result.rs#L109-L145","documentation":"Store<Result<T,E>>::err was consumed where the Err case was required, but the store currently holds Ok. The err() projection only yields a store when the result is an error, so assuming its presence panics.","triggerScenarios":"Thrown at packages/stores/src/impls/result.rs:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The Result value is Ok. Match on the Result before accessing the err payload."],"exampleFix":null,"handlingStrategy":"type-guard","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-14T05:17:10.506Z"}