remotion-dev/remotion · error · Error
Failed to create WebGL texture
Error message
Failed to create WebGL texture
What it means
Thrown by setupProgressivePixelate when gl.createTexture() returns null after VAO, VBO, and attribute wiring succeeded. The largest GL resource the effect allocates, so the most likely to fail under memory pressure.
Source
Thrown at packages/effects/src/progressive-pixelate-runtime.ts:210
const data = new Float32Array([
-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,
]);
const vbo = gl.createBuffer();
if (!vbo) {
throw new Error('Failed to create WebGL buffer');
}
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);
gl.enableVertexAttribArray(1);
gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);
gl.bindVertexArray(null);
const texture = gl.createTexture();
if (!texture) {
throw new Error('Failed to create WebGL texture');
}
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.bindTexture(gl.TEXTURE_2D, null);
return {
gl,
program,
vao,
vbo,
texture,
uniforms: {
uSource: gl.getUniformLocation(program, 'uSource'),
uResolution: gl.getUniformLocation(program, 'uResolution'),View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Compare source dimensions to `gl.getParameter(gl.MAX_TEXTURE_SIZE)` and downscale if exceeded.
- Lower composition resolution.
- Reduce concurrent texture-backed effects.
- Increase Lambda function memory.
- Confirm `gl.isContextLost()` is false and remount if true.
Example fix
// before
setupProgressivePixelate(canvas);
// after — verify texture capacity
function textureFits(gl: WebGL2RenderingContext, w: number, h: number): boolean {
const max = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;
return w <= max && h <= max && !gl.isContextLost();
} Defensive patterns
Strategy: try-catch
Validate before calling
function textureCapacityOk(gl: WebGL2RenderingContext, w: number, h: number): boolean {
if (gl.isContextLost()) return false;
const max = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;
if (w > max || h > max) return false;
const t = gl.createTexture();
if (t) gl.deleteTexture(t);
return t !== null;
} Try / catch
try {
setupProgressivePixelate(canvas);
} catch (err) {
if (/Failed to create WebGL texture/.test((err as Error).message)) {
// downscale source / reduce resolution, then retry
}
throw err;
} Prevention
- Keep source dimensions under MAX_TEXTURE_SIZE.
- Render at the lowest acceptable resolution.
- Limit concurrent texture-backed effects.
- Give Lambda enough memory for SwiftShader texture budget.
When it happens
Trigger: setupProgressivePixelate reaches the texture block; gl.createTexture() returns null.
Common situations: Large source frames; many texture-backed effects; mobile/integrated GPUs with small VRAM; SwiftShader on low-memory Lambda; source exceeding MAX_TEXTURE_SIZE.
Related errors
- Failed to create WebGL texture
- Failed to create WebGL buffer
- Failed to create WebGL texture
- Failed to create WebGL buffer
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/9d57ad4223ec1691.
Report an issue: GitHub.