{"record":{"id":"67a4415cd2ad6c08","repo":"bevyengine/bevy","slug":"unhandled-extension-ext","errorCode":null,"errorMessage":"unhandled extension: {ext}","messagePattern":"unhandled extension: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_shader/src/shader.rs","lineNumber":302,"sourceCode":"        // TODO: remove this once AssetPath forces cross-platform \"slash\" consistency. See #10511\n        let path = path.replace(std::path::MAIN_SEPARATOR, \"/\");\n        let mut bytes = Vec::new();\n        reader.read_to_end(&mut bytes).await?;\n        if ext != \"wesl\" && !settings.shader_defs.is_empty() {\n            tracing::warn!(\n                \"Tried to load a non-wesl shader with shader defs, this isn't supported: \\\n                    The shader defs will be ignored.\"\n            );\n        }\n        let mut shader = match ext.as_str() {\n            \"spv\" => Shader::from_spirv(bytes, load_context.path().path().to_string_lossy()),\n            \"wgsl\" => Shader::from_wgsl(String::from_utf8(bytes)?, path),\n            \"wesl\" => {\n                let mut shader = Shader::from_wesl(String::from_utf8(bytes)?, path);\n                shader.shader_defs = settings.shader_defs.clone();\n                shader\n            }\n            _ => panic!(\"unhandled extension: {ext}\"),\n        };\n\n        // collect and store file dependencies\n        match ext.as_str() {\n            \"wesl\" => {\n                let candidates: Vec<String> = shader\n                    .imports\n                    .iter()\n                    .filter_map(|import| match import {\n                        ShaderImport::AssetPath(asset_path) => {\n                            Some(format!(\"{}.{ext}\", asset_path.trim_start_matches('/')))\n                        }\n                        ShaderImport::Custom(_) => None,\n                    })\n                    .collect();\n                for file_path in candidates {\n                    if load_context\n                        .read_asset_bytes(AssetPath::from(file_path.clone()))","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_shader/src/shader.rs#L284-L320","documentation":"Panic in ShaderLoader::load. The loader only knows how to build a Shader for the extensions 'spv', 'wgsl', and 'wesl'; any other extension routed to this loader reaches the catch-all arm and panics with 'unhandled extension: {ext}'. Since this runs inside the asset loading task, it typically surfaces as a failed/panicking load.","triggerScenarios":"Requesting an asset with an extension ShaderLoader claims but does not handle (loader registration vs. match mismatch), or forcing a custom shader-like extension through the shader loader. The match on ext.as_str() falls through to the panic.","commonSituations":"Adding a new shader format extension to the loader's supported list without extending the match; loading .glsl/.hlsl files expecting automatic transpilation; custom asset pipeline misrouting files.","solutions":["Use one of the supported extensions: .wgsl, .wesl, or .spv","If you need a custom extension, register a dedicated AssetLoader for it instead of routing through ShaderLoader","Verify which loader claims the asset via the AssetServer's loader resolution"],"exampleFix":"// before\nlet handle = asset_server.load(\"shaders/pipeline.glsl\"); // panics: unhandled extension\n\n// after\nlet handle = asset_server.load(\"shaders/pipeline.wgsl\");","handlingStrategy":"validation","validationCode":"const SUPPORTED: [&str; 3] = [\"spv\", \"wgsl\", \"wesl\"];\nlet ext = path.extension().and_then(|e| e.to_str()).unwrap_or(\"\");\nif !SUPPORTED.contains(&ext) {\n    // route to a custom loader or reject before hitting ShaderLoader\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict shader assets to .spv/.wgsl/.wesl","Register dedicated loaders for custom shader formats instead of extending ShaderLoader's claimed extensions"],"tags":["bevy","shader","panic","file-extension","asset-loader"],"backgroundTag":"unsupported-file-extension","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"}