{"record":{"id":"48a037b7622c79b0","repo":"bevyengine/bevy","slug":"pipeline-has-not-been-compiled-yet-it-is-still-in","errorCode":null,"errorMessage":"Pipeline has not been compiled yet. It is still in the 'Queued' state.","messagePattern":"Pipeline has not been compiled yet\\. It is still in the 'Queued' state\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_render/src/render_resource/pipeline_cache.rs","lineNumber":74,"sourceCode":"    Err(ShaderCacheError),\n}\n\nimpl CachedPipelineState {\n    /// Convenience method to \"unwrap\" a pipeline state into its underlying GPU object.\n    ///\n    /// # Returns\n    ///\n    /// The method returns the allocated pipeline GPU object.\n    ///\n    /// # Panics\n    ///\n    /// This method panics if the pipeline GPU object is not available, either because it is\n    /// pending creation or because an error occurred while attempting to create GPU object.\n    pub fn unwrap(&self) -> &Pipeline {\n        match self {\n            CachedPipelineState::Ok(pipeline) => pipeline,\n            CachedPipelineState::Queued => {\n                panic!(\"Pipeline has not been compiled yet. It is still in the 'Queued' state.\")\n            }\n            CachedPipelineState::Creating(..) => {\n                panic!(\"Pipeline has not been compiled yet. It is still in the 'Creating' state.\")\n            }\n            CachedPipelineState::Err(err) => panic!(\"{}\", err),\n        }\n    }\n}\n\n// The default webgpu `max_bind_groups` is 4. Most desktop GPUs support 8.\n// Since the element size we used below is small, we inline 8 on the stack.\nconst BIND_GROUP_LAYOUTS_INLINE_CAPACITY: usize = 8;\n\ntype ImmediateSize = u32;\ntype LayoutCacheKey = (\n    SmallVec<[BindGroupLayoutId; BIND_GROUP_LAYOUTS_INLINE_CAPACITY]>,\n    ImmediateSize,\n);","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_render/src/render_resource/pipeline_cache.rs#L56-L92","documentation":"CachedPipelineState::unwrap() panics when the pipeline is still in the 'Queued' state: it was registered in the PipelineCache (queue_render_pipeline/queue_compute_pipeline) but the background creation task has not started yet. Bevy compiles pipelines asynchronously over multiple frames, so unwrap() only succeeds once creation finished. On the first frames after queueing, the state is Queued and this panic fires.","triggerScenarios":"Calling pipeline_cache.get_render_pipeline_state(id).unwrap() (or get_compute_pipeline_state().unwrap()) in the same frame the pipeline was queued, or any unwrap() before the pipeline-creation systems pick the task up (only a limited number of pipeline compile tasks are started per frame).","commonSituations":"Custom render plugins that queue a pipeline and build bind groups / issue draws in the same system or run before the cache advances; integration tests that don't tick the app enough frames; a large shader backlog (many pipelines queued ahead of yours) during startup.","solutions":["Match on the state instead of unwrap(): only build bind groups and draw when the state is CachedPipelineState::Ok(_)","Split systems so pipelines are queued in one system and consumed in a later system that re-checks readiness every frame","In tests, use PipelineCache::block_on_render_pipeline / block_on_compute_pipeline, or call app.update() several times before asserting","If startup takes too long because only a few pipelines compile per frame, reduce the number of queued pipelines (share layouts/shaders) rather than blocking"],"exampleFix":"// before\nlet pipeline = pipeline_cache.get_render_pipeline_state(pipeline_id).unwrap();\n\n// after\nif let CachedPipelineState::Ok(pipeline) =\n    pipeline_cache.get_render_pipeline_state(pipeline_id)\n{\n    // build bind groups / record draws\n}","handlingStrategy":"type-guard","validationCode":"use bevy::render::render_resource::CachedPipelineState;\n\nfn pipeline_is_ready(\n    cache: &PipelineCache,\n    id: CachedRenderPipelineId,\n) -> bool {\n    matches!(\n        cache.get_render_pipeline_state(id),\n        CachedPipelineState::Ok(_)\n    )\n}","typeGuard":"fn as_ready_pipeline(\n    cache: &PipelineCache,\n    id: CachedRenderPipelineId,\n) -> Option<&bevy::render::render_resource::Pipeline> {\n    match cache.get_render_pipeline_state(id) {\n        CachedPipelineState::Ok(p) => Some(p),\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Never call CachedPipelineState::unwrap() in render systems — treat the cache state as fallible by default","Gate bind-group construction and draw recording behind a CachedPipelineState::Ok match","In tests, use PipelineCache::block_on_render_pipeline or tick app.update() until the state is Ok"],"tags":["bevy","render-pipeline","shader-compilation","async","panic"],"backgroundTag":"async-resource-not-ready","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}