remotion-dev/remotion · error · Error

Failed to create WebGL texture

Error message

Failed to create WebGL texture

What it means

Thrown by setupVenetianBlinds when gl.createTexture() returns null. The texture holds the source frame uploaded via texImage2D each render. A null texture handle means the GL context is lost or the GPU has exhausted its texture object budget — a common failure under high VRAM usage.

Source

Thrown at packages/effects/src/venetian-blinds.ts:282

	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);

	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_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'),
			uProgress: gl.getUniformLocation(program, 'uProgress'),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce render concurrency to lower aggregate VRAM usage
  2. Render at a lower resolution if full resolution is not required
  3. Handle webglcontextlost and retry after restoration
  4. Use a GPU with more VRAM for server-side rendering
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const state = setupVenetianBlinds(canvas);
} catch (err) {
  if (err instanceof Error && err.message === 'Failed to create WebGL texture') {
    // VRAM exhausted or context lost — reduce resolution or concurrency and retry.
    throw new Error('GPU texture allocation failed for venetian-blinds. Lower resolution or concurrency and retry.');
  }
  throw err;
}

Prevention

When it happens

Trigger: After VAO and buffer setup, gl.createTexture() returns null. Occurs when the GL context is lost, when VRAM is exhausted by many large textures across concurrent renders, or when the driver has a low texture object limit.

Common situations: Rendering high-resolution video (4K+) with many concurrent processes each allocating large source textures; GPU with limited VRAM; context loss from driver instability; software rendering with strict texture limits.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/0f0f677bbe43e4e1. Report an issue: GitHub.