{"record":{"id":"b6a0cc13e9fb14e0","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-shader-b6a0cc","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/chromatic-aberration/chromatic-aberration-runtime.ts","lineNumber":28,"sourceCode":"\tgl: WebGL2RenderingContext;\n\tprogram: WebGLProgram;\n\tvao: WebGLVertexArrayObject;\n\tvbo: WebGLBuffer;\n\ttextureSource: WebGLTexture;\n\tuniforms: {\n\t\tuSource: WebGLUniformLocation | null;\n\t\tuOffset: WebGLUniformLocation | null;\n\t};\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(`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":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts#L10-L46","documentation":"Thrown by compileShader() in the chromatic aberration runtime when gl.createShader(type) returns null. A null shader object means the WebGL2 context is lost/destroyed or its shader object budget is exhausted, so compilation cannot begin and effect setup aborts before linking.","triggerScenarios":"setupChromaticAberration() -> createProgram() -> compileShader() calls gl.createShader() at chromatic-aberration-runtime.ts:26; it returns null and the guard at :27 throws.","commonSituations":"Many concurrent compositions, --disable-gpu / SwiftShader overload, blacklisted GPU, context loss during tab throttling, or a VM/lambda without GPU acceleration.","solutions":["Reduce concurrent WebGL-using effects/compositions.","Enable real GPU acceleration in the render browser.","Handle 'webglcontextlost'/'webglcontextrestored' and recreate the effect.","Update GPU drivers; verify WebGL2 support.","Use a GPU-enabled/higher-memory instance server-side."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function probeWebGL2(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    return !!gl && !gl.isContextLost();\n  } catch {\n    return false;\n  }\n}\nif (!probeWebGL2()) skipOrFallback();","typeGuard":null,"tryCatchPattern":"try {\n  return <ChromaticAberration {...props} />;\n} catch (err) {\n  if (/Failed to create WebGL shader/.test(String(err))) return <FallbackFrame />;\n  throw err;\n}","preventionTips":["Limit concurrent WebGL effects to keep shader budgets healthy.","Free GL resources on unmount via the cleanup path.","Recreate the effect after 'webglcontextrestored'.","Render with a GPU-accelerated Chromium."],"tags":["webgl","glsl","shader","gpu","effects","chromatic-aberration","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}