{"record":{"id":"732047c92fa3f540","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-program-732047","errorCode":null,"errorMessage":"Failed to create WebGL program","messagePattern":"Failed to create WebGL program","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/thermal-vision.ts","lineNumber":179,"sourceCode":"\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst log = gl.getShaderInfoLog(shader);\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(\n\t\t\t`Thermal vision shader compile failed: ${log ?? '(no log)'}`,\n\t\t);\n\t}\n\n\treturn shader;\n};\n\nconst linkProgram = (\n\tgl: WebGL2RenderingContext,\n\tvs: WebGLShader,\n\tfs: WebGLShader,\n): WebGLProgram => {\n\tconst program = gl.createProgram();\n\tif (!program) {\n\t\tthrow new Error('Failed to create WebGL program');\n\t}\n\n\tgl.attachShader(program, vs);\n\tgl.attachShader(program, fs);\n\tgl.linkProgram(program);\n\tif (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n\t\tconst log = gl.getProgramInfoLog(program);\n\t\tgl.deleteProgram(program);\n\t\tthrow new Error(`Thermal vision program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nconst createProgram = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/thermal-vision.ts#L161-L197","documentation":"During thermal vision effect `setup`, after both shaders compile, `gl.createProgram()` returned `null`. The WebGL2 context could not allocate a program object, indicating context loss or resource exhaustion. The error fires before shaders are attached.","triggerScenarios":"Context lost between shader compilation and program creation; driver program-object budget exhausted; destroyed/degraded GL context.","commonSituations":"Many simultaneous webgl2 effect setups; long sessions after a driver reset; restrictive headless WebGL2 limits.","solutions":["Lower concurrent webgl2 effect count.","Restart the session/render for a fresh context.","Verify headless Chrome WebGL2 support (`--use-gl=angle`).","Listen for `webglcontextlost` and reinitialize effect state."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const canCreateProgram = (): boolean => {\n  try {\n    const gl = document.createElement('canvas').getContext('webgl2');\n    return !!gl?.createProgram();\n  } catch {\n    return false;\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  thermalVision({...params});\n} catch (e) {\n  if (/Failed to create WebGL program/.test((e as Error).message)) {\n    renderFallbackFrame();\n  } else throw e;\n}","preventionTips":["Cap concurrent webgl2 effects to avoid program-object exhaustion.","Handle context loss/restore to rebuild program state.","Periodically restart long render sessions to reclaim leaked GL objects."],"tags":["thermal-vision","webgl2","gpu","resource-exhaustion","context-lost","setup"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}