{"record":{"id":"e6ca948fbc3e9e86","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-noise-texture-e6ca94","errorCode":null,"errorMessage":"Failed to create WebGL noise texture","messagePattern":"Failed to create WebGL noise texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/roughen-edges.ts","lineNumber":409,"sourceCode":"\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);\n\tgl.texImage2D(\n\t\tgl.TEXTURE_2D,\n\t\t0,\n\t\tgl.RGBA,\n\t\tNOISE_TEXTURE_SIZE,\n\t\tNOISE_TEXTURE_SIZE,\n\t\t0,\n\t\tgl.RGBA,\n\t\tgl.UNSIGNED_BYTE,\n\t\tdata,\n\t);\n};\n\nconst createNoiseTexture = (gl: WebGL2RenderingContext): WebGLTexture => {\n\tconst texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL noise texture');\n\t}\n\n\tuploadNoiseTexture(gl, texture, DEFAULT_SEED);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n\treturn texture;\n};\n\nconst setupRoughenEdges = (target: HTMLCanvasElement): RoughenEdgesState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/roughen-edges.ts#L391-L427","documentation":"Internal error from the `roughenEdges()` effect setup: `gl.createTexture()` returned `null` while allocating the dedicated noise texture (a 256×256 RGBA byte texture seeded by an xorshift PRNG). Environment-level allocation failure, not a param error. Distinct from the source-texture error so the failure point is unambiguous in stack traces.","triggerScenarios":"Context loss between source-texture and noise-texture creation; GPU texture-memory exhaustion; software GL backend with low texture limits.","commonSituations":"Many effects mounted at once; constrained CI GPU; systems resuming from sleep with a stale context.","solutions":["Reload the page or restart the render.","Lower the count of concurrently mounted effects.","Update GPU drivers / use hardware acceleration.","Handle `webglcontextlost` to tear down and re-create textures."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const canAllocateTexture = (): boolean => {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const t = gl.createTexture();\n    if (t) gl.deleteTexture(t);\n    return !!t;\n  } catch {\n    return false;\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  roughenEdges()({...});\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL noise texture/.test(err.message)) {\n    // reduce active effects and retry\n  } else {\n    throw err;\n  }\n}","preventionTips":["Feature-detect texture allocation before mounting effects.","Reduce concurrent effect count to free texture objects.","Call the effect `cleanup` on unmount to release the noise texture.","Handle context loss/restore to rebuild textures."],"tags":["webgl2","roughen-edges-effect","effects","gpu","environment","texture","noise","resource-allocation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}