{"record":{"id":"bfb33dbeff1b63eb","repo":"remotion-dev/remotion","slug":"failed-to-create-lut-shader","errorCode":null,"errorMessage":"Failed to create LUT shader","messagePattern":"Failed to create LUT shader","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/lut-runtime.ts","lineNumber":31,"sourceCode":"\treadonly lutTexture: WebGLTexture;\n\treadonly uniforms: {\n\t\treadonly uSource: WebGLUniformLocation | null;\n\t\treadonly uLut: WebGLUniformLocation | null;\n\t\treadonly uLutSize: WebGLUniformLocation | null;\n\t\treadonly uDomainMin: WebGLUniformLocation | null;\n\t\treadonly uDomainMax: WebGLUniformLocation | null;\n\t};\n\tcachedContent: string | null;\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 LUT 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(`LUT shader compile failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn shader;\n};\n\nconst createProgram = (gl: WebGL2RenderingContext): WebGLProgram => {\n\tconst vertexShader = compileShader(gl, gl.VERTEX_SHADER, LUT_VERTEX_SHADER);\n\tconst fragmentShader = compileShader(\n\t\tgl,\n\t\tgl.FRAGMENT_SHADER,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/lut-runtime.ts#L13-L49","documentation":"During WebGL2 shader creation for the LUT effect, gl.createShader() returned null, meaning the browser could not allocate a shader object. This is a hard WebGL resource-allocation failure, not a shader-source problem (compile errors throw a different message, error 18). It surfaces while setting up the lut() effect on a canvas.","triggerScenarios":"Calling setupLut when the WebGL2 context has been lost (webglcontextlost) or is otherwise exhausted; the GPU context having too many live shader objects; a driver/browser failure to allocate. Any lut() effect setup on a canvas whose context is in a lost state.","commonSituations":"Rendering many compositions/effects that exhaust GPU resources (e.g. Chrome's ~16 live WebGL contexts per page); headless rendering with software GL under memory pressure; context loss after the machine suspends or the GPU resets.","solutions":["Listen for 'webglcontextlost' on the canvas and retry rendering once the context is restored (webglcontextrestored).","Reduce the number of simultaneously live WebGL contexts/canvases on the page (release contexts, use fewer concurrent effects).","Restart the render / reload the page to get a fresh GPU context.","Test in a different browser or with hardware acceleration enabled to rule out a driver/software-GL issue."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const gl = canvas.getContext('webgl2');\nif (!gl) throw new Error('WebGL2 unavailable — LUT effect cannot run');\ncanvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); /* mark for retry */ });","typeGuard":null,"tryCatchPattern":"try {\n  setupEffectWithLut(canvas);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create LUT shader') {\n    // context lost or GPU resources exhausted: wait for webglcontextrestored, then retry once\n  } else throw e;\n}","preventionTips":["Keep live WebGL context count low (browsers cap around 16)","Handle webglcontextlost/webglcontextrestored events on render canvases","Verify hardware acceleration is enabled in the rendering browser","Release old canvases/effects explicitly before creating new ones"],"tags":["webgl","gpu","context-loss"],"backgroundTag":"module-init-failed","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}