{"record":{"id":"03f9d7db52150ba6","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-03f9d7","errorCode":null,"errorMessage":"Failed to create WebGL shader","messagePattern":"Failed to create WebGL shader","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/pixel-dissolve.ts","lineNumber":201,"sourceCode":"\tvec2 gridUv = min(vUv, vec2(1.0) - vec2(0.000001));\n\tvec2 cell = floor(gridUv * divisions);\n\tvec4 color = texture(uSource, vUv);\n\n\tfloat noise = hash21(cell + vec2(uSeed, uSeed * 1.618));\n\tfloat mask = dissolveMask(noise, uProgress, uFeather);\n\n\tfragColor = vec4(color.rgb * mask, color.a * mask);\n}\n`;\n\nconst compileShader = (\n\tgl: WebGL2RenderingContext,\n\ttype: number,\n\tsource: string,\n): WebGLShader => {\n\tconst shader = gl.createShader(type);\n\tif (!shader) {\n\t\tthrow new Error('Failed to create WebGL shader');\n\t}\n\n\tgl.shaderSource(shader, source);\n\tgl.compileShader(shader);\n\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst log = gl.getShaderInfoLog(shader);\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(\n\t\t\t`Pixel Dissolve shader compile failed: ${log ?? '(no log)'}`,\n\t\t);\n\t}\n\n\treturn shader;\n};\n\nconst linkProgram = (\n\tgl: WebGL2RenderingContext,\n\tvs: WebGLShader,","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pixel-dissolve.ts#L183-L219","documentation":"pixelDissolve() compiles fixed GLSL shaders during WebGL2 setup. gl.createShader() returns null only when the context is lost or the driver refuses allocation. Since the shader source is fixed in the library, this null signals a dead/lost context, not a code bug.","triggerScenarios":"Reached in compileShader() during pixelDissolve effect setup before rendering. The WebGL2 context was acquired but createShader now returns null (context lost between acquisition and compile).","commonSituations":"GPU reset mid-setup; context eviction during long renders; headless rendering without a stable GPU; concurrent renders saturating the driver.","solutions":["Ensure a stable WebGL2 context before rendering (real GPU or SwiftShader in CI).","Handle 'webglcontextlost' and re-initialize on 'webglcontextrestored'.","Limit concurrent GPU effects per composition.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  initPixelDissolve(canvas); // compiles pixelDissolve shaders\n} catch (err) {\n  if (isContextLost(canvas)) waitForRestore(canvas).then(initPixelDissolve);\n  else throw err;\n}","preventionTips":["Render on a verified WebGL2-capable environment (real GPU or SwiftShader).","Register webglcontextlost/restored handlers and re-run setup on restore.","Avoid stacking many GPU effects so the driver does not refuse allocations.","Keep GPU drivers current."],"tags":["webgl","gpu","shader","pixel-dissolve","context-loss","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}