remotion-dev/remotion · critical · Error

Failed to create WebGL palette texture

Error message

Failed to create WebGL palette texture

What it means

During starburst effect `setup`, `gl.createTexture()` returned `null` while allocating the color palette texture. This is the last GL resource created during setup and indicates the context cannot allocate a texture object — context loss or resource exhaustion. The VAO, VBO, program, and shaders have all been created successfully by this point.

Source

Thrown at packages/effects/src/starburst.ts:331

		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 paletteTexture = gl.createTexture();
		if (!paletteTexture) {
			throw new Error('Failed to create WebGL palette texture');
		}

		gl.bindTexture(gl.TEXTURE_2D, paletteTexture);
		gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
		gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
		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,
			paletteTexture,
			uColorPalette: gl.getUniformLocation(program, 'colorPalette'),
			uNumRays: gl.getUniformLocation(program, 'numRays'),
			uRotationOffset: gl.getUniformLocation(program, 'rotationOffset'),

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce the number of concurrent webgl2 effects and/or palette sizes.
  2. Restart the render/session to free leaked textures and reset context.
  3. Ensure effect `cleanup` is being called so textures are deleted (`gl.deleteTexture`) between renders.
  4. Handle `webglcontextlost` and rebuild GL state.
Defensive patterns

Strategy: fallback

Try / catch

try {
  starburst({...params});
} catch (e) {
  if (/Failed to create WebGL palette texture/.test((e as Error).message)) {
    renderFallbackFrame();
  } else throw e;
}

Prevention

When it happens

Trigger: Context lost late in setup; GPU texture memory exhausted; too many live GL textures across effects; destroyed GL context.

Common situations: Many concurrent webgl2 effects each holding textures; large palette arrays across many instances; long-running Studio with leaked textures; mobile GPUs with low texture limits.

Related errors


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