bevyengine/bevy · error
DiagnosticsOverlayContents has been tempered with. Parent wa
Error message
DiagnosticsOverlayContents has been tempered with. Parent was not a DiagnosticsOverlay.
What it means
Panic in rebuild_diagnostics_list: a DiagnosticsOverlayContents entity's parent entity does not have a DiagnosticsOverlay component as the overlay UI builder expects. This only happens if user code has re-parented or altered the internally-spawned overlay hierarchy, which the overlay relies on.
Source
Thrown at crates/bevy_dev_tools/src/diagnostics_overlay.rs:306
#[derive(Component)]
struct DiagnosticsOverlayHeader;
/// Section of the overlay that will have the diagnostics
#[derive(Component)]
struct DiagnosticsOverlayContents;
fn rebuild_diagnostics_list(
mut commands: Commands,
diagnostics_overlays: Query<&DiagnosticsOverlay>,
diagnostics_overlay_contents: Query<(Entity, &ChildOf), With<DiagnosticsOverlayContents>>,
diagnostics_store: Res<DiagnosticsStore>,
style: Res<DiagnosticsOverlayStyle>,
) {
for (entity, child_of) in diagnostics_overlay_contents {
commands.entity(entity).despawn_children();
let Ok(diagnostics_overlay) = diagnostics_overlays.get(child_of.get()) else {
panic!("DiagnosticsOverlayContents has been tempered with. Parent was not a DiagnosticsOverlay.");
};
for (i, diagnostic_overlay_item) in diagnostics_overlay.items.iter().enumerate() {
let maybe_diagnostic = diagnostics_store.get(&diagnostic_overlay_item.path);
let diagnostic = maybe_diagnostic
.map(|diagnostic| {
format!(
"{}{}",
diagnostic_overlay_item
.statistic
.fetch(diagnostic)
.map(|sample| format!(
"{:.prec$}",
sample,
prec = diagnostic_overlay_item.precision
))
.unwrap_or("No sample".to_owned()),
diagnostic.suffixView on GitHub (pinned to 396ca72708)
Solutions
- Avoid modifying the diagnostics overlay entity hierarchy
- Rebuild the overlay via DiagnosticsOverlayPlugin instead of moving its entities
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/bevy_dev_tools/src/diagnostics_overlay.rs:306 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/aeec481b8c657c54.
Report an issue: GitHub.