{"record":{"id":"a85184e885542634","repo":"DioxusLabs/dioxus","slug":"tried-to-access-some-on-an-option-value","errorCode":null,"errorMessage":"Tried to access `Some` on an Option value","messagePattern":"Tried to access `Some` on an Option value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/stores/src/impls/option.rs","lineNumber":92,"sourceCode":"\n    /// Transpose the `Store<Option<T>>` into a `Option<Store<T>>`. This will only track the shallow state of the `Option`. It will\n    /// only cause a re-run if the `Option` could change from `None` to `Some` or vice versa.\n    ///\n    /// # Example\n    /// ```rust, no_run\n    /// use dioxus_stores::*;\n    /// let store = use_store(|| Some(42));\n    /// let transposed = store.transpose();\n    /// match transposed {\n    ///     Some(inner_store) => assert_eq!(inner_store(), 42),\n    ///     None => panic!(\"Expected Some\"),\n    /// }\n    /// ```\n    pub fn transpose(self) -> Option<MappedStore<T, Lens>> {\n        self.is_some().then(move || {\n            let map: fn(&Option<T>) -> &T = |value| {\n                value.as_ref().unwrap_or_else(|| {\n                    panic!(\"Tried to access `Some` on an Option value\");\n                })\n            };\n            let map_mut: fn(&mut Option<T>) -> &mut T = |value| {\n                value.as_mut().unwrap_or_else(|| {\n                    panic!(\"Tried to access `Some` on an Option value\");\n                })\n            };\n            self.into_selector().child(0, map, map_mut).into()\n        })\n    }\n\n    /// Unwraps the `Option` and returns a `Store<T>`. This will only track the shallow state of the `Option`. It will\n    /// only cause a re-run if the `Option` could change from `None` to `Some` or vice versa.\n    ///\n    /// # Example\n    /// ```rust, no_run\n    /// use dioxus_stores::*;\n    /// let store = use_store(|| Some(42));","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/stores/src/impls/option.rs#L74-L110","documentation":"A Store<Option<T>> operation (like unwrap/expect via transpose) required the Some case but the underlying Option is None. The store was in the None state, so the Some-typed view is unavailable and the guard panics.","triggerScenarios":"Thrown at packages/stores/src/impls/option.rs:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The Option value is None. Check with pattern matching or as_ref() before accessing the Some 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"}