{"record":{"id":"54ea3660d70591e8","repo":"remotion-dev/remotion","slug":"zigzag-program-link-failed-log-no-log","errorCode":null,"errorMessage":"Zigzag program link failed: ${log ?? '(no log)'}","messagePattern":"Zigzag program link failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/zigzag.ts","lineNumber":379,"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(`Zigzag 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,\n): WebGLProgram => {\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(fs);\n\treturn program;\n};\n","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/zigzag.ts#L361-L397","documentation":"After attaching and linking the zigzag shaders, the effect checks gl.LINK_STATUS; on failure it reads gl.getProgramInfoLog and throws 'Zigzag program link failed: <log>' (or '(no log)'). The shaders are fixed library constants that compiled, so a link failure typically indicates a driver linker bug, mismatched varying/attribute expectations on a non-conformant driver, or context loss during link — not user input.","triggerScenarios":"linkProgram in zigzag.ts: getProgramParameter(LINK_STATUS) is false; the thrown message embeds the driver link log or '(no log)'.","commonSituations":"Driver linker failing on valid GLSL-ES 3.00 programs; context lost mid-link; software renderer with incomplete program linking; memory exhaustion during link.","solutions":["Inspect the embedded <log> for the driver's stated link error (e.g. unresolved varying) to confirm it is a driver issue.","Render headless with Remotion's bundled Chromium and known-good SwiftShader; do not pass --disable-gpu.","Update GPU drivers, especially on the failing host.","Ensure context is not lost (isContextLost()) before rendering; re-mount on webglcontextlost.","Lower concurrent WebGL effects to avoid memory pressure during link."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Program link outcome is driver-dependent on fixed library shaders; caller cannot prevent it.\n// Pre-check context health and run a smoke-test link of trivial shaders.\nconst gl = document.createElement('canvas').getContext('webgl2');\nconst ok = gl != null && !gl.isContextLost();","typeGuard":"const canLinkTrivialProgram = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  if (!gl || gl.isContextLost()) return false;\n  const mk = (t: number, src: string) => {\n    const s = gl.createShader(t)!;\n    gl.shaderSource(s, src);\n    gl.compileShader(s);\n    return s;\n  };\n  const vs = mk(gl.VERTEX_SHADER, '#version 300 es\\nvoid main(){}');\n  const fs = mk(gl.FRAGMENT_SHADER, '#version 300 es\\nout highp vec4 o;void main(){o=vec4(0);}');\n  const p = gl.createProgram()!;\n  gl.attachShader(p, vs);\n  gl.attachShader(p, fs);\n  gl.linkProgram(p);\n  const linked = gl.getProgramParameter(p, gl.LINK_STATUS) === true;\n  gl.deleteProgram(p);\n  return linked;\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[zigzag({colors: ['#ff0000', '#00ff00']})]} />;\n} catch (err) {\n  if (err instanceof Error && /Zigzag program link failed/.test(err.message)) {\n    console.error(err.message); // contains driver link log\n    return <Video />;\n  }\n  throw err;\n}","preventionTips":["Render headless with Remotion's bundled Chromium and known-good SwiftShader; do not pass --disable-gpu.","Update GPU drivers, especially on the failing host.","Smoke-test a trivial program link before relying on shader effects in a new environment.","Ensure context is not lost before rendering; re-mount on webglcontextlost."],"tags":["webgl","shader","gpu","driver","linking"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}