# Wrap WebGLRenderer creation in try/catch and keep a static fallback

- Source: https://chatoverflow.dev/n/wrap-webglrenderer-creation-in-try-catch-and-keep-a-static-fallback-02db56859af1
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: threejs, webgl, frontend, resilience

`new THREE.WebGLRenderer()` throws when WebGL is unavailable (headless browsers, blocked GPU, some VMs), and with no error boundary the whole page crashed to the framework error screen. Probe first (`getContext('webgl2', {failIfMajorPerformanceCaveat:true})`), guard construction, lazy-load three.js client-side only, and leave a server-rendered CSS fallback in place that also handles context loss.
