{"record":{"id":"efc0f90b8440cd3d","repo":"remotion-dev/remotion","slug":"paper-shader-compile-failed-log-no-log","errorCode":null,"errorMessage":"Paper shader compile failed: ${log ?? '(no log)'}","messagePattern":"Paper shader compile failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/paper.ts","lineNumber":665,"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(`Paper 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":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/paper.ts#L647-L683","documentation":"Thrown by compileShader (packages/effects/src/paper.ts:665) when the hardcoded PAPER_VS or (more commonly) PAPER_FS fails gl.COMPILE_STATUS; the info log is appended. PAPER_FS is substantial GLSL ES 3.00 using derivatives (fwidth), dynamic loops, and texture-array lookups, so a compile failure on these correct sources means a driver bug, outdated GPU driver, or an incomplete WebGL2 implementation.","triggerScenarios":"Rendering or previewing paper() on a GPU/driver that mis-compiles GLSL ES 3.00 or lacks standard-derivatives support in hardware; running under a software rasterizer with partial WebGL2; context corruption producing a false compile error.","commonSituations":"Older integrated GPUs; outdated drivers; VM/remote display adapters; headless software WebGL that does not fully implement GLSL ES 3.00.","solutions":["Update the GPU driver on the render host to a version with complete WebGL2/GLSL ES 3.00 and derivative support.","Render on real GPU hardware or GPU-enabled headless Chrome.","Forward the appended info log upstream and disable paper() for that environment."],"exampleFix":"// before\npaper({amount: 1}); // PAPER_FS fails to compile on this driver\n\n// after: probe paper-shader compilation once per host, fall back if it fails\nconst ok = await probePaperShaderCompiles();\nconst effects = ok ? [paper({amount: 1})] : [];","handlingStrategy":"fallback","validationCode":"// One-time per host: compile a GLSL ES 3.00 shader using derivatives to verify the driver\nasync function hostSupportsPaperShader(): Promise<boolean> {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const s = gl.createShader(gl.FRAGMENT_SHADER);\n    if (!s) return false;\n    gl.shaderSource(s, '#version 300 es\\nprecision highp float;\\nout vec4 f;\\nvoid main(){float d=fwidth(gl_FragCoord.x);f=vec4(d);}');\n    gl.compileShader(s);\n    const ok = !!gl.getShaderParameter(s, gl.COMPILE_STATUS);\n    gl.deleteShader(s);\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  scene.push(paper({amount: 1}));\n} catch (err) {\n  if (/Paper shader compile failed/.test(String(err?.message))) {\n    // driver cannot compile PAPER_FS: render without paper on this host\n  } else throw err;\n}","preventionTips":["Keep GPU drivers current; PAPER_FS uses derivatives (fwidth) and dynamic loops.","Render on real GPU hardware rather than software rasterizers.","Feature-probe shader compilation on the target environment and disable paper() where it fails."],"tags":["webgl","gpu","paper","effects","shader","driver","glsl"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}