{"record":{"id":"ecd8ae97226be3dc","repo":"bevyengine/bevy","slug":"could-not-load-shader-0","errorCode":null,"errorMessage":"Could not load shader: {0}","messagePattern":"Could not load shader: (.+?)","errorType":"exception","errorClass":"ShaderLoaderError","httpStatus":null,"severity":"error","filePath":"crates/bevy_shader/src/shader.rs","lineNumber":251,"sourceCode":"    /// The underlying source code string, unless it is SPIR-V.\n    pub fn as_str(&self) -> &str {\n        match self {\n            Source::Wgsl(s) | Source::Wesl(s) => s,\n            Source::SpirV(_) => panic!(\"spirv not yet implemented\"),\n        }\n    }\n}\n\n/// The [`AssetLoader`] responsible for loading unprocessed shader assets.\n#[derive(Default, TypePath)]\npub struct ShaderLoader;\n\n/// An error encountered while loading a shader's source.\n#[non_exhaustive]\n#[derive(Debug, Error)]\n#[expect(missing_docs, reason = \"The variants are self-explanatory.\")]\npub enum ShaderLoaderError {\n    #[error(\"Could not load shader: {0}\")]\n    Io(#[from] std::io::Error),\n    #[error(\"Could not parse shader: {0}\")]\n    Parse(#[from] alloc::string::FromUtf8Error),\n}\n\n/// Settings for loading shaders.\n#[derive(serde::Serialize, serde::Deserialize, Debug, Default)]\npub struct ShaderSettings {\n    /// The shader defs to apply when this shader is loaded.\n    pub shader_defs: Vec<ShaderDefVal>,\n}\n\nimpl AssetLoader for ShaderLoader {\n    type Asset = Shader;\n    type Settings = ShaderSettings;\n    type Error = ShaderLoaderError;\n    async fn load(\n        &self,","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_shader/src/shader.rs#L233-L269","documentation":"ShaderLoaderError::Io from the ShaderLoader asset loader. Reading the shader file from disk failed and the std::io::Error is wrapped with a 'Could not load shader' prefix; the asset load transitions to LoadState::Failed with this error inside.","triggerScenarios":"Loading an asset handled by ShaderLoader (extensions .wgsl/.wesl/.spv) where the file cannot be read: missing file, permission denied, or an I/O error during read. The FromUtf8/load path bubbles the io::Error into this variant.","commonSituations":"Asset path typos; shaders outside the configured asset folder; file permissions in containers/CI; files deleted or renamed during hot-reload.","solutions":["Verify the path printed in the io error exists relative to your asset root","Fix permissions or mount the shader directory into the sandbox/CI environment","Check the AssetServer failed-loads channel to surface these errors instead of silently missing shaders"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let path = std::path::Path::new(&shader_path);\nif !path.exists() {\n    // fail fast with a clear message before requesting the asset\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Watch AssetServer failed loads (server.get_failed_ids / asset_event channel) and log them","Verify shader paths relative to the configured asset root in CI"],"tags":["bevy","shader","io","asset-loader","file-not-found"],"backgroundTag":"file-read-failed","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}