{"record":{"id":"59b8bf336577af73","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-59b8bf","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/linear-progressive-blur/linear-progressive-blur-runtime.ts","lineNumber":39,"sourceCode":"\treadonly programHorizontal: WebGLProgram;\n\treadonly programVertical: WebGLProgram;\n\treadonly vao: WebGLVertexArrayObject;\n\treadonly vbo: WebGLBuffer;\n\treadonly textureSource: WebGLTexture;\n\treadonly textureIntermediate: WebGLTexture;\n\treadonly framebuffer: WebGLFramebuffer;\n\treadonly horizontal: LinearProgressiveBlurUniforms;\n\treadonly vertical: LinearProgressiveBlurUniforms;\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`Linear progressive blur 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":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/linear-progressive-blur/linear-progressive-blur-runtime.ts#L21-L57","documentation":"Thrown by compileShader() in the linear-progressive-blur runtime when gl.createShader() returns null. The WebGL2 context exists but refused to allocate a shader object, so the two-pass blur (horizontal+vertical) cannot be built. Same failure class as the linear-gradient shader allocation, specific to this effect's runtime.","triggerScenarios":"Mounting linearProgressiveBlur during render/preview when the WebGL2 context is lost, GPU memory is exhausted, or the browser's active-context limit is exceeded. The runtime builds two programs (horizontal, vertical), so it stresses shader allocation twice.","commonSituations":"Concurrent Remotion Lambda/local renders saturating GPU objects; headless Chrome without a working GL backend; a crashed Chrome GPU process leaving the context failing; long Studio sessions with many effects mounted.","solutions":["Retry the render once after restarting Chrome/the worker — usually transient.","Force a software GL backend: `--gl=angle --angle-backend=swiftshader`.","Lower `--concurrency` / framesPerLambda to reduce simultaneous contexts.","Update Chrome and GPU drivers on the host.","Inspect Chrome logs for GPU-process crashes ('ContextResult::kTransientFailure')."],"exampleFix":"// before — default GL fails on a GPU-less or saturated host\n//   npx remotion render MyComp out.mp4\n\n// after\n//   npx remotion render MyComp out.mp4 --gl=angle --angle-backend=swiftshader","handlingStrategy":"retry","validationCode":"function supportsWebGL2ShaderAlloc(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const probe = gl.createShader(gl.VERTEX_SHADER);\n  const ok = probe !== null;\n  if (probe) gl.deleteShader(probe);\n  return ok;\n}","typeGuard":null,"tryCatchPattern":"try {\n  renderWithLinearProgressiveBlur();\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL shader') {\n    await restartRendererWorker();\n    renderWithLinearProgressiveBlur();\n  } else throw err;\n}","preventionTips":["Force a software GL backend on serverless/CI hosts.","Cap concurrency — this effect creates two programs and stresses allocation more than single-program effects.","Use the Remotion-bundled Chrome.","Recycle the worker after GPU-process crashes."],"tags":["webgl","gpu","rendering","resource-exhaustion","browser-env"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}