{"record":{"id":"e5dd359ac9dcf215","repo":"DavidHDev/react-bits","slug":"no-webgl-2-context-e5dd35","errorCode":null,"errorMessage":"No WebGL 2 context!","messagePattern":"No WebGL 2 context!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/ts-tailwind/Components/InfiniteMenu/InfiniteMenu.tsx","lineNumber":764,"sourceCode":"  public run(time = 0): void {\n    this._deltaTime = Math.min(32, time - this._time);\n    this._time = time;\n    this._deltaFrames = this._deltaTime / this.TARGET_FRAME_DURATION;\n    this._frames += this._deltaFrames;\n\n    this.animate(this._deltaTime);\n    this.render();\n\n    requestAnimationFrame(t => this.run(t));\n  }\n\n  private init(onInit?: InitCallback): void {\n    const gl = this.canvas.getContext('webgl2', {\n      antialias: true,\n      alpha: false\n    });\n    if (!gl) {\n      throw new Error('No WebGL 2 context!');\n    }\n    this.gl = gl;\n\n    vec2.set(this.viewportSize, this.canvas.clientWidth, this.canvas.clientHeight);\n    vec2.clone(this.drawBufferSize);\n\n    this.discProgram = createProgram(gl, [discVertShaderSource, discFragShaderSource], null, {\n      aModelPosition: 0,\n      aModelNormal: 1,\n      aModelUvs: 2,\n      aInstanceMatrix: 3\n    });\n\n    this.discLocations = {\n      aModelPosition: gl.getAttribLocation(this.discProgram!, 'aModelPosition'),\n      aModelUvs: gl.getAttribLocation(this.discProgram!, 'aModelUvs'),\n      aInstanceMatrix: gl.getAttribLocation(this.discProgram!, 'aInstanceMatrix'),\n      uWorldMatrix: gl.getUniformLocation(this.discProgram!, 'uWorldMatrix'),","sourceCodeStart":746,"sourceCodeEnd":782,"githubUrl":"https://github.com/DavidHDev/react-bits/blob/c7109dccb42e06592d1d9bc50bc87204697240e2/src/ts-tailwind/Components/InfiniteMenu/InfiniteMenu.tsx#L746-L782","documentation":"Tailwind/TypeScript variant of errors 0 and 6. InfiniteMenu.init calls canvas.getContext('webgl2', { antialias:true, alpha:false }) and throws when null because the instanced disc pipeline (aInstanceMatrix at slot 3) needs WebGL2 with no webgl1 fallback.","triggerScenarios":"getContext('webgl2') returns null at src/ts-tailwind/Components/InfiniteMenu/InfiniteMenu.tsx:760-766 during init(), before discProgram is built.","commonSituations":"jsdom/Vitest without GL; outdated browsers (old Safari/iOS, embedded WebViews); WebGL2 on the driver blocklist; software renderers exposing only webgl1; CI without a WebGL2-capable headless browser.","solutions":["Probe WebGL2 support before mounting InfiniteMenu and render a fallback if absent.","In tests, use a WebGL2-capable headless browser or mock the component.","Update GPU drivers/browser; confirm chrome://gpu shows WebGL2 hardware-accelerated.","Enable hardware acceleration in the host browser/WebView."],"exampleFix":"// before\nconst gl = this.canvas.getContext('webgl2', { antialias: true, alpha: false });\nif (!gl) throw new Error('No WebGL 2 context!');\n\n// after\nfunction hasWebGL2() {\n  try { return !!document.createElement('canvas').getContext('webgl2'); }\n  catch { return false; }\n}\nif (!hasWebGL2()) return <FallbackMenu />;","handlingStrategy":"validation","validationCode":"function supportsWebGL2(): boolean {\n  try { return !!document.createElement('canvas').getContext('webgl2'); }\n  catch { return false; }\n}\nif (!supportsWebGL2()) return <FallbackMenu />;","typeGuard":"function hasWebGL2(canvas: HTMLCanvasElement): boolean {\n  return !!canvas.getContext('webgl2', { antialias: true, alpha: false });\n}","tryCatchPattern":null,"preventionTips":["Probe WebGL2 at boot and gate the tailwind TS InfiniteMenu on it.","Mock the component in jsdom; use a GL-capable headless browser otherwise.","Ship a non-WebGL fallback menu for unsupported browsers.","Confirm WebGL2 is hardware-accelerated (chrome://gpu)."],"tags":["webgl2","gpu","context","initialization","browser-support","typescript","tailwind","infinitemenu"],"backgroundTag":null,"analyzedSha":"c7109dccb42e06592d1d9bc50bc87204697240e2","analyzedAt":"2026-08-13T02:32:07.327Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}