{"record":{"id":"e4042ca57ac7ec20","repo":"bevyengine/bevy","slug":"assetindex-index-has-been-removed","errorCode":null,"errorMessage":"AssetIndex {index:?} has been removed","messagePattern":"AssetIndex (.+?) has been removed","errorType":"exception","errorClass":"InvalidGenerationError","httpStatus":null,"severity":"error","filePath":"crates/bevy_asset/src/assets.rs","lineNumber":743,"sourceCode":"            None\n        }\n    }\n}\n\n/// An error returned when an [`AssetIndex`] has an invalid generation.\n#[derive(Error, Debug, PartialEq, Eq)]\npub enum InvalidGenerationError {\n    /// The generation of this [`AssetIndex`] does not match the current generation.\n    /// That means its index entry has been replaced.\n    #[error(\"AssetIndex {index:?} has an invalid generation. The current generation is: '{current_generation}'.\")]\n    Occupied {\n        /// The index being looked up.\n        index: AssetIndex,\n        /// The generation currently at that index.\n        current_generation: u32,\n    },\n    /// This index entry has been removed.\n    #[error(\"AssetIndex {index:?} has been removed\")]\n    Removed { index: AssetIndex },\n}\n\n#[cfg(test)]\nmod test {\n    use crate::tests::create_app;\n    use crate::{Asset, AssetApp, AssetEvent, AssetIndex, Assets};\n    use bevy_ecs::prelude::Messages;\n    use bevy_reflect::TypePath;\n\n    #[test]\n    fn asset_index_round_trip() {\n        let asset_index = AssetIndex {\n            generation: 42,\n            index: 1337,\n        };\n        let roundtripped = AssetIndex::from_bits(asset_index.to_bits());\n        assert_eq!(asset_index, roundtripped);","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_asset/src/assets.rs#L725-L761","documentation":"InvalidGenerationError variant indicating the AssetIndex's index entry has been removed entirely: the slot generation no longer exists because the asset at that index was dropped. Any handle still pointing at this index cannot be resolved to a live asset.","triggerScenarios":"Thrown at crates/bevy_asset/src/assets.rs:743 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Drop or stop using handles that reference the removed index","Re-load or re-create the asset to obtain a new valid index/handle","Avoid manually constructing AssetIndex values; use handles returned by the Assets<T> API"],"exampleFix":null,"handlingStrategy":"validation","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"}