remotion-dev/remotion · error · Error
Failed to create WebGL texture
Error message
Failed to create WebGL texture
What it means
Thrown by duotone's createRgbaTexture() when gl.createTexture() returns null. The program and vertex array already succeeded, so the context exists; a null texture means the driver could not allocate another texture object, again indicating context loss or resource exhaustion.
Source
Thrown at packages/effects/src/duotone.ts:190
};
const createProgram = (
gl: WebGL2RenderingContext,
vertexSource: string,
fragmentSource: string,
): WebGLProgram => {
const vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
const fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
const program = linkProgram(gl, vs, fs);
gl.deleteShader(vs);
gl.deleteShader(fs);
return program;
};
const createRgbaTexture = (gl: WebGL2RenderingContext): WebGLTexture => {
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 texture;
};
const setupDuotone = (target: HTMLCanvasElement): DuotoneState => {
const gl = target.getContext('webgl2', {
premultipliedAlpha: true,
alpha: true,
preserveDrawingBuffer: true,
});
if (!gl) {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Render with a software backend: `npx remotion render <comp> --gl=swiftshader`.
- Lower render concurrency to reduce simultaneous texture allocation.
- Restart the render worker / relaunch Chrome to recover a lost context.
- Update GPU drivers / Chromium.
Defensive patterns
Strategy: try-catch
Try / catch
async function safeRender(opts) {
try {
return await renderMedia(opts);
} catch (err) {
if (/Failed to create WebGL texture/.test(String(err?.message ?? ''))) {
return await renderMedia({...opts, gl: 'swiftshader', concurrency: 1});
}
throw err;
}
} Prevention
- Reduce concurrency to lower simultaneous texture allocation pressure.
- Prefer a software GL backend in constrained/headless environments.
- Restart the render worker if you suspect a leaked/lost context.
- Keep GPU drivers / Chromium updated.
When it happens
Trigger: Occurs during setupDuotone() when allocating the source texture that will receive each frame's pixel data. Triggered when the GPU texture-object budget is exhausted or the context is lost after the VAO was created.
Common situations: Many concurrent GPU-effect frames, a frame with many textures in flight, a GPU process crash, or a sandboxed headless Chrome with constrained texture memory.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL program
- Failed to create WebGL vertex array
- 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/e04db251ab9d361a.
Report an issue: GitHub.