tinyhumansai/openhuman · error

[MeshGradient] createShader returned null — WebGL context ma

Error message

[MeshGradient] createShader returned null — WebGL context may be lost

What it means

gl.createShader returned null during mesh-gradient material setup, which the code attributes to a lost WebGL context. Context loss (driver reset, resource pressure, too many contexts) invalidates the existing handle — every subsequent GL call on it fails or returns null. The renderer cannot build programs in this state; the visual freezes or goes blank until the canvas/context is recreated.

Source

Thrown at app/src/lib/meshGradient.js:56

              const t = new Date();
              (t - _miniGl.lastDebugMsg > 1e3 && console.log('---'),
                console.log(
                  t.toLocaleTimeString() + Array(Math.max(0, 32 - e.length)).join(' ') + e + ': ',
                  ...Array.from(arguments).slice(1)
                ),
                (_miniGl.lastDebugMsg = t));
            }
          : () => {}),
      Object.defineProperties(_miniGl, {
        Material: {
          enumerable: false,
          value: class {
            constructor(vertexShaders, fragments, uniforms = {}) {
              const material = this;
              function getShaderByType(type, source) {
                const shader = context.createShader(type);
                if (!shader) {
                  console.warn(
                    '[MeshGradient] createShader returned null — WebGL context may be lost'
                  );
                  return null;
                }
                return (
                  context.shaderSource(shader, source),
                  context.compileShader(shader),
                  context.getShaderParameter(shader, context.COMPILE_STATUS) ||
                    console.error(context.getShaderInfoLog(shader)),
                  _miniGl.debug('Material.compileShaderSource', { source: source }),
                  shader
                );
              }
              function getUniformVariableDeclarations(uniforms, type) {
                return Object.entries(uniforms)
                  .map(([uniform, value]) => value.getDeclaration(uniform, type))
                  .join('\n');
              }

View on GitHub (pinned to 7491200858)

Solutions

  1. Listen for the webglcontextlost/restored events on the canvas and rebuild the MiniGl renderer on restoration
  2. Reduce live WebGL contexts (fewer gradient canvases) to avoid resource-pressure loss
  3. Driver resets cause transient loss — remounting the gradient component recreates the context
  4. If recurrent, check GPU driver stability and webview GPU acceleration settings
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/src/lib/meshGradient.js:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/092f6ba27f3e0393. Report an issue: GitHub.