{"record":{"id":"3b987e8785d188a7","repo":"bevyengine/bevy","slug":"bin-not-present","errorCode":null,"errorMessage":"Bin not present","messagePattern":"Bin not present","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_render/src/render_phase/mod.rs","lineNumber":634,"sourceCode":"        match instance_removal_result.displaced_instance {\n            // Case 1: The instance was removed from the middle of the array. In\n            // that case, we have a *displaced entity* that was swapped in to\n            // fill the hole. We need to update the table that maps binned mesh\n            // instance index to entity and the reverse table that maps entity\n            // to binned mesh instance index.\n            Some((displaced_instance_index, displaced_instance)) => {\n                debug_assert_eq!(\n                    displaced_instance_index.0 + 1,\n                    self.binned_mesh_instance_index_to_entity.len() as u32\n                );\n                let displaced_entity = self.binned_mesh_instance_index_to_entity.pop().expect(\n                    \"If an entity was displaced, the list of mesh instances must be nonempty\",\n                );\n                self.binned_mesh_instance_index_to_entity\n                    [instance_removal_result.removed_instance_index.0 as usize] = displaced_entity;\n                self.bins[displaced_instance.bin_index as usize]\n                    .as_mut()\n                    .expect(\"Bin not present\")\n                    .entity_to_binned_mesh_instance_index\n                    .insert(\n                        displaced_entity,\n                        instance_removal_result.removed_instance_index,\n                    );\n            }\n\n            // Case 2: The instance was removed from the end of the array. In\n            // that case, we have no displaced entity, so all we need to do is\n            // to remove it from the instance index to entity table.\n            None => {\n                debug_assert_eq!(\n                    instance_removal_result.removed_instance_index.0 + 1,\n                    self.binned_mesh_instance_index_to_entity.len() as u32\n                );\n                let removed_entity = self.binned_mesh_instance_index_to_entity.pop();\n                debug_assert_eq!(removed_entity, Some(main_entity));\n            }","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/bevyengine/bevy/blob/221e52ae323febfd399bd7d067918fc43648cfb3/crates/bevy_render/src/render_phase/mod.rs#L616-L652","documentation":"During entity removal (mod.rs:635), a displaced instance (swapped in to fill the hole left by swap_remove) must be re-filed into its bin; 'Bin not present' fires when that bin's slot in the bins vector is None. It is the downstream half of the same removal path as 'Entity not in bin' and 'Bin key not present' and indicates the same class of bookkeeping desync.","triggerScenarios":"An entity removal displaced an instance whose recorded bin_index points at a freed or empty slot in the bins vector while the instance tables still reference it.","commonSituations":"Same contexts as the other bin panics: heavy spawn/despawn churn with multidraw batching, interleaved bin freeing and instance removal, Bevy upgrade regressions.","solutions":["Upgrade Bevy to the latest patch release.","Reduce double-removal / same-frame churn that stresses the bin lifecycle.","Report upstream with a minimal repro; this is an engine invariant guard."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid double-removal patterns that stress bin bookkeeping under multidraw batching.","Test spawn/despawn-heavy scenes when upgrading Bevy versions.","Report upstream when this fires without custom bin manipulation."],"tags":["bevy","multidraw","swap-remove","panic","bin"],"backgroundTag":"internal-invariant-violation","analyzedSha":"221e52ae323febfd399bd7d067918fc43648cfb3","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}