{"record":{"id":"184ce24ac079636f","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-184ce2","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/drop-shadow/drop-shadow-runtime.ts","lineNumber":58,"sourceCode":"\treadonly composite: {\n\t\treadonly uSource: WebGLUniformLocation | null;\n\t\treadonly uShadow: WebGLUniformLocation | null;\n\t\treadonly uOffset: WebGLUniformLocation | null;\n\t\treadonly uTexelSize: WebGLUniformLocation | null;\n\t};\n\treadonly colorCtx: CanvasRenderingContext2D;\n\tcachedColorStr: string;\n\tcachedColorRgba: ParsedColorRgba;\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(`Drop shadow shader compile failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn shader;\n};\n\nconst linkProgram = (\n\tgl: WebGL2RenderingContext,\n\tvs: WebGLShader,\n\tfs: WebGLShader,\n): WebGLProgram => {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/drop-shadow/drop-shadow-runtime.ts#L40-L76","documentation":"Thrown by the drop-shadow runtime's compileShader helper when gl.createShader() returns null. Equivalent to the dot-grid case: the WebGL2 context could not allocate a shader object, almost always because the context is lost, destroyed, or resource-exhausted. The drop-shadow effect compiles four shaders (extract, horizontal blur, vertical blur, composite), so the first failing allocation throws.","triggerScenarios":"Lost WebGL2 context, exhausted shader limit, GPU memory pressure, or headless environment without GPU acceleration. Reached inside setupDropShadow() during initial shader compilation.","commonSituations":"Headless Chromium without software GL flags; long Studio sessions leaking shaders; GPU driver crash; many drop-shadow instances mounted; remote desktop / VM with passthrough GL.","solutions":["Feature-detect WebGL2 before applying the effect: const gl = canvas.getContext('webgl2'); if (!gl) skip.","For headless rendering, launch Chrome with --use-gl=angle --use-angle=swiftshader (or the matching software renderer).","Reduce simultaneous drop-shadow instances; ensure cleanup runs to free shaders/programs.","Reload to recover from a lost context; update GPU drivers and browser.","File a Remotion issue if it reproduces on a freshly booted WebGL2-capable desktop browser."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = () => {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n};\n\nif (!supportsWebGL2()) {\n  // omit the drop-shadow effect or render a CSS box-shadow fallback","typeGuard":null,"tryCatchPattern":"try {\n  state = setupDropShadow(canvas);\n} catch (err) {\n  if (err instanceof Error && /WebGL shader/i.test(err.message)) {\n    console.error('Drop-shadow shader allocation failed:', err.message);\n    // fall back to a CSS box-shadow layer\n  } else {\n    throw err;\n  }\n}","preventionTips":["Feature-detect WebGL2 before applying drop-shadow().","Run headless rendering with a software GL backend and adequate memory.","Keep simultaneous drop-shadow instances low; ensure cleanupDropShadow runs.","Update GPU drivers and the browser."],"tags":["webgl2","drop-shadow","shader","gpu","runtime","headless"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}