{"record":{"id":"2988ed48b3d7b902","repo":"gfx-rs/wgpu","slug":"could-not-create-shader","errorCode":null,"errorMessage":"Could not create shader","messagePattern":"Could not create shader","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/gles/adapter.rs","lineNumber":1020,"sourceCode":"    unsafe fn compile_shader(\n        source: &str,\n        gl: &glow::Context,\n        shader_type: u32,\n        es: bool,\n    ) -> Option<glow::Shader> {\n        let source = if es {\n            format!(\"#version 300 es\\nprecision lowp float;\\n{source}\")\n        } else {\n            let version = gl.version();\n            if version.major == 3 && version.minor == 0 {\n                // OpenGL 3.0 only supports this format\n                format!(\"#version 130\\n{source}\")\n            } else {\n                // OpenGL 3.1+ support this format\n                format!(\"#version 140\\n{source}\")\n            }\n        };\n        let shader = unsafe { gl.create_shader(shader_type) }.expect(\"Could not create shader\");\n        unsafe { gl.shader_source(shader, &source) };\n        unsafe { gl.compile_shader(shader) };\n\n        if !unsafe { gl.get_shader_compile_status(shader) } {\n            let msg = unsafe { gl.get_shader_info_log(shader) };\n            if !msg.is_empty() {\n                log::error!(\"\\tShader compile error: {msg}\");\n            }\n            unsafe { gl.delete_shader(shader) };\n            None\n        } else {\n            Some(shader)\n        }\n    }\n\n    unsafe fn create_shader_clear_program(\n        gl: &glow::Context,\n        es: bool,","sourceCodeStart":1002,"sourceCodeEnd":1038,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/gles/adapter.rs#L1002-L1038","documentation":"Panic in the GLES adapter's shader-clear helper: gl.create_shader returned no shader object for the internal clear shader, indicating the GL context rejected shader creation (context lost or resource limits). The faulty input is the current GL context state.","triggerScenarios":"Thrown at wgpu-hal/src/gles/adapter.rs:1020 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after the GL context is restored; check for context-loss before adapter use","Avoid exhausting GL object limits; recreate the context if creation persistently fails"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}