{"record":{"id":"aeec481b8c657c54","repo":"bevyengine/bevy","slug":"diagnosticsoverlaycontents-has-been-tempered-with","errorCode":null,"errorMessage":"DiagnosticsOverlayContents has been tempered with. Parent was not a DiagnosticsOverlay.","messagePattern":"DiagnosticsOverlayContents has been tempered with\\. Parent was not a DiagnosticsOverlay\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_dev_tools/src/diagnostics_overlay.rs","lineNumber":306,"sourceCode":"#[derive(Component)]\nstruct DiagnosticsOverlayHeader;\n\n/// Section of the overlay that will have the diagnostics\n#[derive(Component)]\nstruct DiagnosticsOverlayContents;\n\nfn rebuild_diagnostics_list(\n    mut commands: Commands,\n    diagnostics_overlays: Query<&DiagnosticsOverlay>,\n    diagnostics_overlay_contents: Query<(Entity, &ChildOf), With<DiagnosticsOverlayContents>>,\n    diagnostics_store: Res<DiagnosticsStore>,\n    style: Res<DiagnosticsOverlayStyle>,\n) {\n    for (entity, child_of) in diagnostics_overlay_contents {\n        commands.entity(entity).despawn_children();\n\n        let Ok(diagnostics_overlay) = diagnostics_overlays.get(child_of.get()) else {\n            panic!(\"DiagnosticsOverlayContents has been tempered with. Parent was not a DiagnosticsOverlay.\");\n        };\n\n        for (i, diagnostic_overlay_item) in diagnostics_overlay.items.iter().enumerate() {\n            let maybe_diagnostic = diagnostics_store.get(&diagnostic_overlay_item.path);\n            let diagnostic = maybe_diagnostic\n                .map(|diagnostic| {\n                    format!(\n                        \"{}{}\",\n                        diagnostic_overlay_item\n                            .statistic\n                            .fetch(diagnostic)\n                            .map(|sample| format!(\n                                \"{:.prec$}\",\n                                sample,\n                                prec = diagnostic_overlay_item.precision\n                            ))\n                            .unwrap_or(\"No sample\".to_owned()),\n                        diagnostic.suffix","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_dev_tools/src/diagnostics_overlay.rs#L288-L324","documentation":"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.","triggerScenarios":"Thrown at crates/bevy_dev_tools/src/diagnostics_overlay.rs:306 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid modifying the diagnostics overlay entity hierarchy","Rebuild the overlay via DiagnosticsOverlayPlugin instead of moving its entities"],"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"}