{"record":{"id":"9041e5817f082436","repo":"bevyengine/bevy","slug":"diagnosticsoverlay-has-been-tempered-with-do-not","errorCode":null,"errorMessage":"DiagnosticsOverlay has been tempered with. Do not despawn its children.","messagePattern":"DiagnosticsOverlay has been tempered with\\. Do not despawn its children\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_dev_tools/src/diagnostics_overlay.rs","lineNumber":472,"sourceCode":"    }\n}\n\nfn collapse_on_click_to_header(\n    mut event: On<PointerClick>,\n    mut diagnostics_overlays: Query<&Children, With<DiagnosticsOverlay>>,\n    mut diagnostics_overlay_contents: Query<&mut Node, With<DiagnosticsOverlayContents>>,\n    diagnostics_overlay_header: Query<&ChildOf, With<DiagnosticsOverlayHeader>>,\n) {\n    if event.duration > Duration::from_millis(250) {\n        return;\n    }\n\n    let entity = event.entity;\n    if let Ok(child_of) = diagnostics_overlay_header.get(entity) {\n        event.propagate(false);\n\n        let Ok(children) = diagnostics_overlays.get_mut(child_of.get()) else {\n            unreachable!(\"DiagnosticsOverlay has been tempered with. Do not despawn its children.\");\n        };\n        let mut lists_iter = diagnostics_overlay_contents\n            .iter_many_mut(children.collection())\n            .matched();\n\n        let Some(mut node) = lists_iter.fetch_next() else {\n            panic!(\n                \"DiagnosticsOverlay has been tempered with. DiagnosticsOverlay must\\\n            have a child with DiagnosticsList.\"\n            );\n        };\n\n        let next_display_mode = match node.display {\n            Display::Grid => Display::None,\n            Display::None => Display::Grid,\n            _ => panic!(\n                \"The DiagnosticsList has be tempered with. Valid Displays for a\\\n            DiagnosticsList are Grid or None.\"","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_dev_tools/src/diagnostics_overlay.rs#L454-L490","documentation":"Marked unreachable in collapse_on_click_to_header: the DiagnosticsOverlay entity has no Children component, meaning its child list was removed after spawning. The overlay always spawns with children, so this indicates user code despawned or stripped them.","triggerScenarios":"Thrown at crates/bevy_dev_tools/src/diagnostics_overlay.rs:472 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not despawn or remove children of the diagnostics overlay","Recreate the overlay through DiagnosticsOverlayPlugin if the hierarchy was modified"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}