{"record":{"id":"e2295fb835d43da1","repo":"remotion-dev/remotion","slug":"unknown-shader-compile-error","errorCode":null,"errorMessage":"Unknown shader compile error","messagePattern":"Unknown shader compile error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/white-noise.ts","lineNumber":118,"sourceCode":"`;\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 shader');\n\t}\n\n\tgl.shaderSource(shader, source);\n\tgl.compileShader(shader);\n\n\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\tconst info = gl.getShaderInfoLog(shader) ?? 'Unknown shader compile error';\n\t\tgl.deleteShader(shader);\n\t\tthrow new Error(info);\n\t}\n\n\treturn shader;\n};\n\nconst createProgram = (\n\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WebGLProgram => {\n\tconst vertex = compileShader(gl, gl.VERTEX_SHADER, vertexSource);\n\tconst fragment = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n\tconst program = gl.createProgram();\n\tif (!program) {\n\t\tthrow new Error('Failed to create program');\n\t}\n\n\tgl.attachShader(program, vertex);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/white-noise.ts#L100-L136","documentation":"When the white noise shader fails gl.COMPILE_STATUS, the effect reads gl.getShaderInfoLog for diagnostics; if that too returns null it throws the literal message 'Unknown shader compile error'. Since the shader source is a fixed library constant, a compile failure with no info log indicates a driver/GPU fault (out of memory during compile, broken compiler, lost context) rather than bad GLSL or a user parameter.","triggerScenarios":"compileShader in white-noise.ts: getShaderParameter(COMPILE_STATUS) is false AND getShaderInfoLog returns null/empty, so the fallback string is thrown.","commonSituations":"A GPU driver whose shader compiler silently fails (common with some SwiftShader builds or outdated mobile drivers); shader compilation interrupted by context loss; extremely constrained GPU memory during compile; rare GLSL-ES 3.00 gaps in a software renderer.","solutions":["Render with Remotion's bundled Chromium which ships a known-good software-GPU (SwiftShader) build, instead of a system browser with an older/broken GL compiler.","Update GPU drivers or switch rendering host to one with a conformant WebGL2 shader compiler.","Reduce concurrent effects so shader compilation is not starved of memory.","Confirm the context is not lost before rendering (isContextLost()); re-mount on webglcontextlost.","Report a driver bug if the failure reproduces only on one GPU vendor."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No caller-side guard can prevent a driver shader-compiler failure with no log.\n// Best pre-check: confirm a healthy context and known-good renderer string.\nconst gl = document.createElement('canvas').getContext('webgl2');\nif (gl) {\n  const renderer = gl.getParameter(gl.RENDERER);\n  // SwiftShader/known-good renderers compile the library shaders reliably.\n}","typeGuard":"const isKnownGoodRenderer = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  if (!gl || gl.isContextLost()) return false;\n  const r = String(gl.getParameter(gl.RENDERER));\n  return /SwiftShader|ANGLE|NVIDIA|Intel|AMD|Radeon/i.test(r);\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[whiteNoise({amount: 0.4})]} />;\n} catch (err) {\n  if (err instanceof Error && err.message === 'Unknown shader compile error') {\n    // driver failed silently: fall back to no effect and flag the environment\n    return <Video />;\n  }\n  throw err;\n}","preventionTips":["Use Remotion's bundled Chromium which ships a known-good SwiftShader; avoid system browsers with broken GL compilers.","Keep GPU drivers current on render hosts.","Do not disable the software GPU in headless flags.","Ensure the context is not lost before rendering."],"tags":["webgl","shader","gpu","driver","headless"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}