Skip to content

Errors and Edge Cases

Mark Rogers edited this page Oct 27, 2026 · 3 revisions

What tw check reports

tw check prints the renderer, scene and pixel lines (see Commands), then one heading per kind of problem, then result:. The headings it printed in the runs below are EXCEPTIONS, ERRORS, CHECK and fix hints; three's own deprecation warnings have their own heading and always fail. Any problem makes the result PROBLEMS FOUND and the exit code 1. Other console warnings only print, unless --strict. A 404 for /favicon.ico is ignored.

A lit mesh and no light

The repository's tests/fixtures/pages/black-mesh page has a MeshStandardMaterial cube, no light and no environment:

tw check black-mesh/
page: http://127.0.0.1:<port>/index.html
three: r186 · scenes 1 · render calls <n>
renderer: WebGLRenderer canvas 960x540 dpr 1 · draw calls 1 · tris 12 · geometries 1 · textures 1 · programs 1 · output srgb · toneMapping None · shadows false
gpu: ANGLE (NVIDIA, NVIDIA GeForce RTX 5060 Ti (0x00002D04) Direct3D11 vs_5_0 ps_5_0, D3D11)
cdn: 2 file(s) served locally (three@0.186.1 from cache)
scene: Scene 1, Mesh 1
  meshes 1 · lights 0 · verts 24 · tris 12 · materials 1 · textures 0 · environment false · background null
bounds: center 0,0,0 size 1,1,1
camera: PerspectiveCamera pos 0,0,4 fov 50 near 0.1 far 50 aspect 1.78
pixels: 0% differ from the background #000000 · mean luma 0 · <n> colours
CHECK (2):
  lit materials but no lights and no scene.environment: meshes will render black
  the canvas is one flat colour (#000000): nothing rendered, or the camera sees nothing
result: PROBLEMS FOUND

A camera aspect set without updateProjectionMatrix

tests/fixtures/pages/stale-projection sets camera.aspect and never updates the projection. The check reads the projection matrix, so it catches it (since 0.3.0):

tw check stale-projection/
CHECK (1):
  camera.aspect is 1.78 but the projection matrix still uses 1: call camera.updateProjectionMatrix() after setting aspect
result: PROBLEMS FOUND

A bare "three" import with no import map

tw check missing-import-map/
page: http://127.0.0.1:<port>/index.html
three: not detected · scenes 0 · render calls <n>
gpu: ANGLE (NVIDIA, NVIDIA GeForce RTX 5060 Ti (0x00002D04) Direct3D11 vs_5_0 ps_5_0, D3D11)
EXCEPTIONS (1):
  TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".
ERRORS (1):
  Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".
CHECK (1):
  no three.js scene observed (three.js not loaded, a second copy of three, or nothing rendered yet)
fix hints (1):
  the import map lacks an entry for this specifier; addons import bare "three", so map "three" (and "three/addons/", "three/webgpu", "three/tsl" as used)
result: PROBLEMS FOUND

The fix hints come from scripts/lib/hints.mjs, which matches known error texts (a missing import-map entry, a missing DRACOLoader, a WebGPU texture swizzle error).

Exit codes

Command 0 1
check, shaders OK, every program linked a problem found, a program failed
lint no errors (warnings and notes allowed) an error; with --strict, any warning
glb report printed, warnings allowed with --strict, any warning
diff PASS FAIL
versions --check everything current a package behind

An unknown command prints the help and exits 2; a command that throws prints the error and exits 1 (scripts/tw.mjs).

What tw glb warns about

The warnings and their thresholds are listed on Commands. One number there changed meaning in 0.6.6: draw calls are counted per node that draws a mesh, not per mesh (see Versions and upgrading).

Known limits

  • result: OK does not mean the page looks right: bloom-webgpu once passed while blown out (HANDOFF). Look at one tw shot.
  • WebGPURenderer's info.render.calls counts render() calls since the start; the per-frame number is info.render.drawCalls.
  • tw shaders lists WebGL programs only; WebGPU WGSL errors show up in tw check.
  • Headless Chrome reports prefers-color-scheme: dark; pass --color-scheme light for a light palette.
  • Headless Chrome ran at a 60 fps vsync cap on the test machine, so tw perf fps is uninformative; read p95, p99 and max.
  • --eval takes one expression; join steps with commas.
  • Git Bash does not convert /tmp/...?query paths; pass a C:/... path when a local page carries a query string outside /c/. tw maps /c/... itself on Windows (0.4.1).
  • On the html-importmap starter, which animates, the scene bounds and the screenshot's pixel box move between runs, and the render-call count depends on how long the page ran. A check --against comparison can report a real change even when the source is unchanged. The browser test uses a static fixture from 0.6.7; the comparison thresholds are unchanged.
  • In one of seven verification runs, tw scene site/ printed only the root Scene line with no children; the other runs printed the full tree. Not reproduced since; if it happens, run it again or use tw check site/ --tree.

Clone this wiki locally