{"record":{"id":"b4497a5549c7d740","repo":"leptos-rs/leptos","slug":"at-location-the-sandboxed-arenas-feature-is-a","errorCode":null,"errorMessage":"at {location}, the `sandboxed-arenas` feature is active, but no Arena is active","messagePattern":"at (.+?), the `sandboxed-arenas` feature is active, but no Arena is active","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"reactive_graph/src/owner/arena.rs","lineNumber":53,"sourceCode":"        #[cfg(feature = \"sandboxed-arenas\")]\n        {\n            let new_arena = Arc::downgrade(arena);\n            MAP.with_borrow_mut(|arena| {\n                *arena = Some(new_arena);\n            })\n        }\n    }\n\n    #[track_caller]\n    pub fn with<U>(fun: impl FnOnce(&ArenaMap) -> U) -> U {\n        #[cfg(not(feature = \"sandboxed-arenas\"))]\n        {\n            fun(&MAP.get_or_init(Default::default).read().or_poisoned())\n        }\n        #[cfg(feature = \"sandboxed-arenas\")]\n        {\n            Arena::try_with(fun).unwrap_or_else(|| {\n                panic!(\n                    \"at {}, the `sandboxed-arenas` feature is active, but no \\\n                     Arena is active\",\n                    std::panic::Location::caller()\n                )\n            })\n        }\n    }\n\n    #[track_caller]\n    pub fn try_with<U>(fun: impl FnOnce(&ArenaMap) -> U) -> Option<U> {\n        #[cfg(not(feature = \"sandboxed-arenas\"))]\n        {\n            Some(fun(&MAP.get_or_init(Default::default).read().or_poisoned()))\n        }\n        #[cfg(feature = \"sandboxed-arenas\")]\n        {\n            MAP.with_borrow(|arena| {\n                arena","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/reactive_graph/src/owner/arena.rs#L35-L71","documentation":"reactive_graph's Arena::with reads reactive state through an Arena when the `sandboxed-arenas` feature is enabled. If the closure runs without any Arena active in the current thread/scope, try_with returns None and the library panics, reporting the source location of the call.","triggerScenarios":"Enabling the `sandboxed-arenas` cargo feature and then calling Arena::with(...) (or any reactive read routed through it) outside of an Arena-entered scope.","commonSituations":"Testing or benchmarking with sandboxed-arenas enabled but creating the Arena only in part of the code; background threads/spawned tasks accessing reactive values without entering an Arena first.","solutions":["Create and enter an Arena before the call so try_with succeeds.","Disable the `sandboxed-arenas` feature if you rely on the default global MAP storage.","Ensure tasks touching reactive state are spawned inside the Arena's scope or receive values explicitly."],"exampleFix":"// before\nlet value = Arena::with(|map| compute(map)); // panics: no active arena\n// after\nlet arena = Arena::new();\nlet value = arena.enter(|| Arena::with(|map| compute(map)));","handlingStrategy":"validation","validationCode":"fn arena_active() -> bool {\n    Arena::try_with(|_| ()).is_some()\n}\n// call before reactive reads when sandboxed-arenas is enabled","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    Arena::with(|map| compute(map))\n}));","preventionTips":["Enter an Arena at the top of every thread/task that touches reactive state.","Only enable sandboxed-arenas when you control all state-access entry points.","Add tests that run reactive reads with the feature enabled."],"tags":["rust","reactive-graph","arena","feature-flag","panic"],"backgroundTag":"no-active-arena","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}