{"record":{"id":"62b1f86de9a259d4","repo":"remotion-dev/remotion","slug":"tear-program-link-failed-log-no-log","errorCode":null,"errorMessage":"Tear program link failed: ${log ?? '(no log)'}","messagePattern":"Tear program link failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/effects/src/tear.ts","lineNumber":215,"sourceCode":"};\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(`Tear program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nconst createTearState = (gl: WebGL2RenderingContext): TearState => {\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(fs);\n\n\tconst vao = gl.createVertexArray();\n\tif (!vao) {\n\t\tthrow new Error('Failed to create WebGL vertex array');\n\t}\n\n\tgl.bindVertexArray(vao);","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/effects/src/tear.ts#L197-L233","documentation":"The Tear effect's vertex and fragment shaders compiled individually but failed to link into a program (gl.LINK_STATUS false). The library reads gl.getProgramInfoLog(), deletes the program, and throws with the driver's log. Common causes are the driver refusing to link (resource limits, driver bugs) rather than authoring errors, since the effect's shaders are prebuilt.","triggerScenarios":"gl.linkProgram() failing during Tear state creation, typically after a driver/GPU resource problem, or on drivers with buggy GLSL ES 3.00 linkers; also possible if the context became lost between compile and link steps.","commonSituations":"Headless/CI software rasterizers with incomplete program linking; GPU memory exhaustion (too many compiled programs/textures); known driver bugs on older Intel/ANGLE versions; browser regressions.","solutions":["Read the appended link log for the driver's specific reason","Update GPU drivers and the browser","Free GPU resources (other effects, tabs, contexts) and retry","If headless, switch to a GPU-backed environment or newer SwiftShader","Report to Remotion with the log if it reproduces on current drivers"],"exampleFix":"// before (rendering with outdated llvmpipe in CI)\n// container uses old mesa\n// after\n// pin a newer Chrome/Mesa image, e.g. playwright image with current deps\n// docker run mcr.microsoft.com/playwright:vlatest","handlingStrategy":"try-catch","validationCode":"const gl = canvas.getContext('webgl2');\nif (!gl) throw new Error('WebGL2 unavailable');\nconst vs = gl.createShader(gl.VERTEX_SHADER)!;\ngl.shaderSource(vs, '#version 300 es\\nin vec2 aPos; void main(){ gl_Position = vec4(aPos,0.0,1.0); }');\ngl.compileShader(vs);\nconst p = gl.createProgram();\ngl.attachShader(p, vs);\ngl.linkProgram(p);\nconst linkOk = gl.getProgramParameter(p, gl.LINK_STATUS);\ngl.deleteProgram(p); gl.deleteShader(vs);\nif (!linkOk) throw new Error('Program linking unsupported on this driver: ' + gl.getProgramInfoLog(p));","typeGuard":"function canLinkPrograms(gl: WebGL2RenderingContext): boolean {\n  return !gl.isContextLost() && gl.getProgramParameter !== undefined;\n}","tryCatchPattern":"try {\n  renderWithTear(...);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Tear program link failed')) {\n    console.error('GL link log:', err.message);\n    // switch to a non-WebGL fallback effect or a different machine/driver\n  } else throw err;\n}","preventionTips":["Smoke-test program linking in the target environment (CI images, Lambda) before batch renders","Update Mesa/ANGLE/GPU drivers in containers and CI","Limit concurrent GPU workloads to avoid resource exhaustion during link","Pin known-good browser versions for deterministic headless rendering"],"tags":["webgl","glsl","program-link","gpu"],"backgroundTag":"shader-compile-failed","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}