{"record":{"id":"a0708f97d3614884","repo":"remotion-dev/remotion","slug":"zigzag-shader-compile-failed-log-no-log","errorCode":null,"errorMessage":"Zigzag shader compile failed: ${log ?? '(no log)'}","messagePattern":"Zigzag shader compile failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/zigzag.ts","lineNumber":357,"sourceCode":"}\n`;\n\nconst compileShader = (\n\tgl: WebGL2RenderingContext,\n\ttype: number,\n\tsource: string,\n): WebGLShader => {\n\tconst shader = gl.createShader(type);\n\tif (!shader) {\n\t\tthrow new Error('Failed to create WebGL shader');\n\t}\n\n\tgl.shaderSource(shader, source);\n\tgl.compileShader(shader);\n\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst log = gl.getShaderInfoLog(shader);\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(`Zigzag shader compile failed: ${log ?? '(no log)'}`);\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);","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/zigzag.ts#L339-L375","documentation":"After allocating and compiling the zigzag shaders, the effect checks gl.COMPILE_STATUS; on failure it reads gl.getShaderInfoLog and throws 'Zigzag shader compile failed: <log>' (or '(no log)' if the driver gave none). The GLSL is a fixed #version 300 es string baked into the library, so a real compile failure implicates the GPU driver/compiler or context state, not caller input — no zigzag parameter reaches the shader source.","triggerScenarios":"compileShader in zigzag.ts: getShaderParameter(COMPILE_STATUS) is false; the thrown message embeds the driver's info log or '(no log)'.","commonSituations":"A GPU/SwiftShader build whose GLSL-ES 3.00 compiler rejects valid constructs; context loss interrupting compile; extremely memory-constrained compile; outdated mobile/VM driver with partial GLSL-ES 3.00 support.","solutions":["Read the embedded <log> in the message — it usually names the exact GLSL line/driver error and pinpoints the driver bug.","Render with Remotion's bundled Chromium and its known-good SwiftShader; do not disable the software GPU.","Update GPU drivers on the failing host.","Ensure the context is not lost (isContextLost()) before rendering; re-mount on webglcontextlost.","If the log shows a genuine compiler rejection of valid GLSL, report a driver bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// The shader source is a library constant; caller cannot change compile outcome.\n// Pre-check context health and renderer identity to avoid known-bad drivers.\nconst gl = document.createElement('canvas').getContext('webgl2');\nconst ok = gl != null && !gl.isContextLost();","typeGuard":"const hasConformantCompiler = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  if (!gl || gl.isContextLost()) return false;\n  // quick smoke compile of a trivial GLSL-ES 3.00 shader\n  const s = gl.createShader(gl.VERTEX_SHADER);\n  if (!s) return false;\n  gl.shaderSource(s, '#version 300 es\\nvoid main(){}');\n  gl.compileShader(s);\n  const compiled = gl.getShaderParameter(s, gl.COMPILE_STATUS) === true;\n  gl.deleteShader(s);\n  return compiled;\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[zigzag({colors: ['#ff0000', '#00ff00']})]} />;\n} catch (err) {\n  if (err instanceof Error && /Zigzag shader compile failed/.test(err.message)) {\n    // err.message contains the driver log — log it for diagnosis, then degrade\n    console.error(err.message);\n    return <Video />;\n  }\n  throw err;\n}","preventionTips":["Use Remotion's bundled Chromium with its known-good SwiftShader; avoid --disable-gpu.","Keep GPU drivers updated on render hosts.","Smoke-test a trivial GLSL-ES 3.00 compile before relying on shader effects in an unknown environment.","Confirm context is not lost before rendering; re-mount on webglcontextlost."],"tags":["webgl","shader","gpu","driver","compilation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}