{"record":{"id":"0f33117bcb958ec6","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-0f3311","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/drop-shadow/drop-shadow-runtime.ts","lineNumber":110,"sourceCode":"};\n\nconst createProgram = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WebGLProgram => {\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(fs);\n\treturn program;\n};\n\nconst createRgbaTexture = (gl: WebGL2RenderingContext): WebGLTexture => {\n\tconst texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL texture');\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n\treturn texture;\n};\n\nconst getBlurUniforms = (\n\tgl: WebGL2RenderingContext,\n\tprogram: WebGLProgram,\n): DropShadowState['horizontal'] => ({\n\tuRadius: gl.getUniformLocation(program, 'uRadius'),\n\tuTexelSize: gl.getUniformLocation(program, 'uTexelSize'),\n\tuSource: gl.getUniformLocation(program, 'uSource'),","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/drop-shadow/drop-shadow-runtime.ts#L92-L128","documentation":"Thrown by the drop-shadow runtime's createRgbaTexture helper when gl.createTexture() returns null. A null texture signals a lost or resource-exhausted WebGL2 context. The drop-shadow runtime allocates three RGBA textures (source, shadowA, shadowB), so the first allocation that fails throws.","triggerScenarios":"Lost WebGL2 context, exceeded texture object limit, or GPU memory exhaustion. Reached inside setupDropShadow() during the triple-texture allocation phase.","commonSituations":"Texture leaks from effects whose cleanup was skipped; rendering very large frames on low-memory GPUs; many drop-shadow instances; headless rendering under memory pressure; GPU reset.","solutions":["Confirm cleanupDropShadow runs so gl.deleteTexture reclaims all three textures on unmount.","Reduce the number of simultaneous drop-shadow effects or lower composition resolution.","Reload to free leaked textures.","For headless/CI, use SwiftShader with sufficient memory and limit concurrency.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = () => {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  state = setupDropShadow(canvas);\n} catch (err) {\n  if (err instanceof Error && /WebGL texture/i.test(err.message)) {\n    console.error('Drop-shadow texture allocation failed:', err.message);\n    // fall back to a CSS box-shadow layer\n  } else {\n    throw err;\n  }\n}","preventionTips":["Confirm cleanupDropShadow runs so all three textures are deleted on unmount.","Reduce composition resolution or simultaneous effect count on low-memory GPUs.","Reload to reclaim leaked textures; use SwiftShader with adequate memory for headless runs."],"tags":["webgl2","drop-shadow","texture","gpu","runtime","memory"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}