remotion-dev/remotion · error · Error
Failed to create WebGL texture
Error message
Failed to create WebGL texture
What it means
Thrown by pixelDissolve setup when gl.createTexture() returns null after the program, VAO, VBO, and attribute wiring all succeeded. Textures are typically the most memory-hungry GL resource, so this is the most common allocation to fail when the GPU is under texture-memory pressure.
Source
Thrown at packages/effects/src/pixel-dissolve.ts:308
const vs = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);
const fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
const program = linkProgram(gl, vs, fs);
gl.deleteShader(vs);
gl.deleteShader(fs);
const {vao, vbo} = createFullscreenQuad(gl);
const aPos = gl.getAttribLocation(program, 'aPos');
const aUv = gl.getAttribLocation(program, 'aUv');
gl.enableVertexAttribArray(aPos);
gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
gl.enableVertexAttribArray(aUv);
gl.vertexAttribPointer(aUv, 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_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.bindTexture(gl.TEXTURE_2D, null);
return {
gl,
program,
vao,
vbo,
texture,
uSource: gl.getUniformLocation(program, 'uSource'),
uProgress: gl.getUniformLocation(program, 'uProgress'),
uColumns: gl.getUniformLocation(program, 'uColumns'),View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Lower the composition resolution or the source asset dimensions and re-render — texture allocation scales with frame pixel count.
- Check `gl.getParameter(gl.MAX_TEXTURE_SIZE)` against your source dimensions and downscale assets that exceed it.
- Increase Remotion Lambda function memory so SwiftShader has more texture budget.
- Run fewer simultaneous texture-backed effects in one composition.
- Verify the context is not lost with `gl.isContextLost()` and remount the effect if it is.
Example fix
// before
import {pixelDissolve} from '@remotion/effects';
const effect = pixelDissolve();
// after — gate on texture-size limits before mounting
function supportsTextureForSize(w: number, h: number): boolean {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
const maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;
return w <= maxSize && h <= maxSize && !gl.isContextLost();
} Defensive patterns
Strategy: try-catch
Validate before calling
function textureFitsMax(gl: WebGL2RenderingContext, w: number, h: number): boolean {
if (gl.isContextLost()) return false;
const max = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;
return w <= max && h <= max;
}
// also probe allocation:
function glCanCreateTexture(gl: WebGL2RenderingContext): boolean {
const t = gl.createTexture();
if (t) gl.deleteTexture(t);
return t !== null;
} Try / catch
try {
pixelDissolve();
} catch (err) {
if (/Failed to create WebGL texture/.test((err as Error).message)) {
// downscale source asset or reduce composition resolution, then retry
}
throw err;
} Prevention
- Keep source asset dimensions at or below the GPU's MAX_TEXTURE_SIZE.
- Render at the lowest acceptable composition resolution.
- Avoid mounting many texture-heavy effects simultaneously.
- Increase Lambda function memory so SwiftShader has texture headroom.
When it happens
Trigger: pixelDissolve setup reaches createTexture() in the final block of the setup function; all earlier GL objects were created successfully but the texture unit cannot allocate. Often paired with large source video frames being uploaded to the same context.
Common situations: Rendering high-resolution (4K+) video where each frame uploads a fresh texture; many effects sharing a context; mobile or integrated GPUs with small VRAM; SwiftShader on Lambda with a memory-starved function; the source image exceeds MAX_TEXTURE_SIZE on the implementation.
Related errors
- Failed to create WebGL buffer
- Failed to create WebGL texture
- Failed to create WebGL texture
- Failed to create WebGL texture
- Failed to create WebGL texture
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/990d4cbc67cfed93.
Report an issue: GitHub.