{"record":{"id":"d300662f31b168bb","repo":"DioxusLabs/dioxus","slug":"the-tree-has-not-been-built-yet-make-sure-to-call","errorCode":null,"errorMessage":"The tree has not been built yet. Make sure to call rebuild on the tree before accessing its nodes.","messagePattern":"The tree has not been built yet\\. Make sure to call rebuild on the tree before accessing its nodes\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/scopes.rs","lineNumber":94,"sourceCode":"/// This state erases the type of the component's props. It is used to store the state of a component in the runtime.\npub struct ScopeState {\n    pub(crate) runtime: Rc<Runtime>,\n    pub(crate) context_id: ScopeId,\n    pub(crate) props: BoxedAnyProps,\n    /// The last mounted output for this component.\n    pub(crate) last_rendered_node: Option<MountedOutput>,\n    pub(crate) reactive_context: ReactiveContext,\n}\n\nimpl ScopeState {\n    /// Get a handle to the currently active head node arena for this Scope\n    ///\n    /// This is useful for traversing the tree outside of the VirtualDom, such as in a custom renderer or in SSR.\n    ///\n    /// Panics if the tree has not been built yet.\n    pub fn root_node(&self) -> &VNode {\n        self.try_root_node()\n            .expect(\"The tree has not been built yet. Make sure to call rebuild on the tree before accessing its nodes.\")\n    }\n\n    /// Try to get a handle to the currently active head node arena for this Scope\n    ///\n    /// This is useful for traversing the tree outside of the VirtualDom, such as in a custom renderer or in SSR.\n    ///\n    /// Returns [`None`] if the tree has not been built yet.\n    pub fn try_root_node(&self) -> Option<&VNode> {\n        match &self.last_rendered_node {\n            Some(output) => Some(output.as_vnode()),\n            None => None,\n        }\n    }\n\n    /// Try to get the currently active root node with its mounted identity.\n    ///\n    /// Returns [`None`] if the tree has not been built or mounted yet.\n    pub fn try_mounted_root_node(&self) -> Option<MountedVNode<'_>> {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/core/src/scopes.rs#L76-L112","documentation":"Accessed a component's root node before the VirtualDom has ever rendered it. root_node only has data after rebuild/rebuild_absorption has produced output for that scope; querying earlier returns this error.","triggerScenarios":"Thrown at packages/core/src/scopes.rs:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call `rebuild` (or launch the app normally) before accessing nodes of the VirtualDOM tree; the tree must be built at least once first."],"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"}