{"record":{"id":"6d8879a4efcc8efc","repo":"bevyengine/bevy","slug":"no-neighbor-from-current-focus-in-the-direction","errorCode":null,"errorMessage":"No neighbor from {current_focus} in the {direction:?} direction.","messagePattern":"No neighbor from (.+?) in the (.+?) direction\\.","errorType":"exception","errorClass":"DirectionalNavigationError","httpStatus":null,"severity":"info","filePath":"crates/bevy_input_focus/src/directional_navigation.rs","lineNumber":443,"sourceCode":"                NavNeighbor::Set(new_focus) => {\n                    self.focus.set(new_focus, FocusCause::Navigated);\n                    Ok(new_focus)\n                }\n            }\n        } else {\n            Err(DirectionalNavigationError::NoFocus)\n        }\n    }\n}\n\n/// An error that can occur when navigating between focusable entities using [directional navigation](crate::directional_navigation).\n#[derive(Debug, PartialEq, Clone, Error)]\npub enum DirectionalNavigationError {\n    /// No focusable entity is currently set.\n    #[error(\"No focusable entity is currently set.\")]\n    NoFocus,\n    /// No neighbor in the requested direction.\n    #[error(\"No neighbor from {current_focus} in the {direction:?} direction.\")]\n    NoNeighborInDirection {\n        /// The entity that was the focus when the error occurred.\n        current_focus: Entity,\n        /// The direction in which the navigation was attempted.\n        direction: CompassOctant,\n    },\n    /// Navigation explicitly blocked in the requested direction.\n    #[error(\"Navigation explicitly blocked from {current_focus} in the {direction:?} direction.\")]\n    BlockedNavigation {\n        /// The entity that was the focus when the error occurred.\n        current_focus: Entity,\n        /// The direction in which the navigation was attempted.\n        direction: CompassOctant,\n    },\n}\n\n/// A focusable area with position and size information.\n///","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_input_focus/src/directional_navigation.rs#L425-L461","documentation":"DirectionalNavigation::navigate found a current focus but the DirectionalNavigationMap has no neighbor for that entity in the requested direction. In the manual map, an unset direction resolves to NavNeighbor::Auto, which the plain DirectionalNavigation system parameter reports as this error (bevy_ui's AutoDirectionalNavigator instead resolves it geometrically).","triggerScenarios":"Calling navigate with a CompassOctant for which no manual edge was defined via DirectionalNavigationMap::add_edge / add_symmetrical_edge / add_edges, or (with automatic navigation) pressing a direction at the layout edge where no candidate focusable exists.","commonSituations":"Pressing right on the rightmost menu item; a UI with a single focusable element; the intended target lacks the Focusable component or is invisible; manual-navigation setups where only some directions were wired.","solutions":["If using manual navigation, define edges for that direction with add_edge, add_edges, or add_looping_edges (looping edges give wrap-around menus).","Treat the error as an expected boundary hit: log at debug level or ignore, since focus simply stays put.","Verify the element you expect to reach actually has the Focusable component and is visible."],"exampleFix":"// before: no edge defined for East -> NoNeighborInDirection at the right edge\n\n// after: wrap-around menu edges\nnav_map.add_looping_edges(&[item_a, item_b, item_c], CompassOctant::East);","handlingStrategy":"fallback","validationCode":"use bevy_input_focus::directional_navigation::DirectionalNavigationMap;\n\nfn has_neighbor_in(map: &DirectionalNavigationMap, focus: Entity, dir: CompassOctant) -> bool {\n    map.get_neighbors(focus)\n        .map(|n| n.get(dir).is_set())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match nav.navigate(dir) {\n    Ok(next) => { /* focus already moved */ }\n    Err(DirectionalNavigationError::NoNeighborInDirection { .. }) => {\n        // boundary hit: keep focus, optionally wrap manually\n    }\n    Err(e) => warn!(\"{e}\"),\n}","preventionTips":["Wire wrap-around menus with add_looping_edges.","Log this variant at debug level so edge presses do not spam warnings.","Ensure every intended navigation target is Focusable and visible."],"tags":["bevy","input-focus","directional-navigation","ui","focus-edges","menu"],"backgroundTag":"spatial-navigation-edge-reached","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}