{"record":{"id":"018f9d160d63af40","repo":"bevyengine/bevy","slug":"camera-entity-wasn-t-synced-018f9d","errorCode":null,"errorMessage":"Camera entity wasn't synced.","messagePattern":"Camera entity wasn't synced\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_solari/src/realtime/extract.rs","lineNumber":13,"sourceCode":"use super::{prepare::SolariLightingResources, SolariLighting};\nuse bevy_camera::Camera;\nuse bevy_ecs::system::{Commands, ResMut};\nuse bevy_pbr::deferred::SkipDeferredLighting;\nuse bevy_render::{sync_world::RenderEntity, MainWorld};\n\npub fn extract_solari_lighting(mut main_world: ResMut<MainWorld>, mut commands: Commands) {\n    let mut cameras_3d = main_world.query::<(RenderEntity, &Camera, Option<&mut SolariLighting>)>();\n\n    for (entity, camera, solari_lighting) in cameras_3d.iter_mut(&mut main_world) {\n        let mut entity_commands = commands\n            .get_entity(entity)\n            .expect(\"Camera entity wasn't synced.\");\n        if let Some(mut solari_lighting) = solari_lighting\n            && camera.is_active\n        {\n            entity_commands.insert((solari_lighting.clone(), SkipDeferredLighting));\n            solari_lighting.reset = false;\n        } else {\n            entity_commands.remove::<(\n                SolariLighting,\n                SolariLightingResources,\n                SkipDeferredLighting,\n            )>();\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_solari/src/realtime/extract.rs#L1-L28","documentation":"extract_solari_lighting (bevy_solari realtime/extract.rs:11-14) queries (RenderEntity, &Camera, Option<&mut SolariLighting>) from the main world and expects commands.get_entity(entity) to return Some. The panic fires when the render-world counterpart of the camera does not exist — a violation of the main/render world sync invariant maintained by bevy_render. It is an engine-level failure, not something the Solari API itself validates.","triggerScenarios":"A camera entity despawned or its RenderEntity mapping invalidated between sync and Solari's extract; custom render schedules that reorder extraction or sync; direct mutation of sync_world entities from plugins; mixed Bevy versions in one build.","commonSituations":"Toggling Solari lighting on cameras that are spawned/despawned every frame; custom RenderApp setups (custom render graphs, added extract systems); upgrading with partially updated bevy crates.","solutions":["Use deferred commands to despawn cameras rather than despawning during extract","Deactivate the Camera (is_active = false) instead of despawning when toggling Solari lighting","Review custom extract/sync system ordering against bevy_render's SyncPlugin","Align Bevy versions and update; if reproducible, file an issue with a minimal example"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer deactivating the camera over despawning it when Solari lighting is toggled per-frame","Do not mutate RenderEntity/sync_world mappings from game code or plugins","Keep extract system sets unmodified when adding Solari to a custom render setup"],"tags":["bevy","solari","camera","render-world","entity-sync","panic"],"backgroundTag":"render-entity-sync-failed","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}