Error help

Margo Engine keeps its error messages short and ends each one with a link to its entry on this page, for example Mesh disposed; see https://margoengine.com/errors#disposed. Errors that are not a TypeError or RangeError are a MargoError with a stable code: branch on error.code, not on the message. Optional packages follow the same pattern.

Codes

version: incompatible core installations or package builds

Cause. A package and engine resolve different core module paths, or the package was built against a different exact core version. Separate installs have separate class identities and registries even when their version numbers match.

Fix. Use one @margoengine/core installation and rebuild or update the packages to its exact version. Check the versions and module paths in the error. Deduplicate dependencies and map umbrella and scoped imports to the same core. The check runs before plugin setup or runtime access and does not create a global registry.

disposed: used after dispose()

Engine disposed Mesh disposed Transforms disposed Lights disposed; create another addLights handle Viewer extras disposed; create another viewer Pipeline is disposed; create a new graph Pipeline disposed; create a new graph

Cause. The engine, a mesh or the transform store was disposed, and the code kept a reference and called it again. A pick still waiting when the engine is disposed resolves null instead.

Fix. Drop references when you call dispose(), and create a new Engine or mesh (engine.createMesh()) to keep drawing. Check engine.disposed before late callbacks (timers, fetches, promise continuations) touch the engine.

unsupported: the browser or device lacks something needed

Register the viewer element in a browser with Custom Elements

Cause. The browser or GPU lacks a capability the call needs. See the WebGPU entry for the messages core throws.

Fix. Feature-test before calling, or offer a fallback path. Branch on error.code === "unsupported".

state: not valid right now

XR button needs a canvas on the page or the parent option Viewer model has no geometry to frame Physics exists on this stage: pass its options on the first call or set them on the world Clustered already exists; set options on the first addLights call Wait for the viewer element load event or ready promise Viewer extras needs a canvas parent or parent option Hotspot already exists; remove it before adding it again This model has no animation clips Picking disabled; set picking: true Pipeline changed during execution; request the updated output

Cause. The call is valid in general but not at this moment: a re-entrant call from a callback, a missing prerequisite, or a device that is being restored. The re-entrancy, device restore and install entries list the messages.

Fix. Retry later, from outside the callback, or after the prerequisite is in place.

failed: the operation ran and produced no result

BiomeWorld GPU device lost; recreate the WebGPU device

Cause. The GPU or the transform kernel could not complete the work. See the GPU lost and limits entries.

Fix. Read the message for the GPU or kernel detail; most failures are recovered by the engine or need smaller inputs.

timeout: a WebGPU startup step never settled

WebGPU requestAdapter never settled WebGPU requestDevice never settled WebGPU createRenderPipelineAsync never settled Margo: still waiting for <step> after 8 s

Cause. The browser or GPU driver never answered a step of Engine.create: the adapter or device request, or a pipeline compile. Seen on an Intel Arc 140V when 3 or 4 WebGPU pages were alive at once in one browser process: each new page got slower to get a device, and the 4th never did, with no error. The engine warns once after startupWarning ms (default 8000) and rejects after startupTimeout ms (default 30000).

Fix. Start fewer engines at once on one page or in one browser (start the next when the previous one has drawn, or close pages you no longer show). With backend: "auto" and fallback: webglRenderer from @margoengine/webgl2-compat/preview the page draws on WebGL2 instead. Raise startupTimeout for a slow first compile; pass signal to cancel creation yourself. Branch on error.code === "timeout".

attached: the target already has an owner

Cause. Something that takes one owner at a time was attached twice: a canvas presentation owner, a camera projection, a mesh deformer, a sound controller or a voice. The second attach is refused so the first keeps working.

Fix. Release the first owner (call its dispose() or the function it returned) before attaching another, or create a separate target for the second. The message names what is already attached.

Messages

@margoengine/sky: physical planet atmosphere

Planet atmosphere needs a GPUDevice; use WebGPU or webgl2-compat Planet atmosphere is disposed; create a new instance Planet camera lies below ground; keep the observer outside the planet Planet atmosphere needs radii at most 100000 km and vertical scattering depth at most 6; reduce the medium Planet frame needs finite transforms, nonzero sun, illuminance 0..1000000 and exposure -20..20

Cause. The planet frame or medium is outside its physical numeric domain, or its resources were disposed.

Fix. Use a WebGPU or compatibility GPUDevice, finite kilometre transforms, an observer outside ground, nonzero sun and bounded atmosphere parameters. Recreate disposed resources.

Content Security Policy and WebAssembly

Wasm compilation blocked by CSP; add 'wasm-unsafe-eval' to script-src

Cause. The browser refused to compile Wasm because script-src (or its default-src fallback) does not allow it. Emscripten may wrap the CompileError or EvalError in an abort.

Fix. Serve Content-Security-Policy: script-src 'self' 'wasm-unsafe-eval' on the page and worker responses. Keep the other directives your app needs. This permits Wasm compilation without permitting JavaScript eval. See docs/csp.md in the repository for the packages and worker policy.

@margoengine/creative: texture render targets

Cause. A texture target dimension, mip, layer, format, load operation or clear color is outside its supported range.

Fix. Use cube, array or 3d with positive integer dimensions within device limits and a total allocation at most 256 MiB. Cubes have six square faces. Render one mip and layer at a time. Use rgba8unorm or rgba16float, and finite four-component clear colors. See the creative package README for every default and range.

Moving a canvas to a worker

transferCanvas needs a canvas element in a browser with OffscreenCanvas transferCanvas: expected a Worker transferCanvas: timeout above 0 This canvas has a context or already moved to a worker Worker failed before it took the canvas The worker never called receiveCanvas The page never called transferCanvas receiveCanvas: timeout above 0

Cause. A canvas moves to a worker once, before anything draws on it, and both sides must take part: the page calls transferCanvas and the worker calls receiveCanvas. The call failed because the browser has no OffscreenCanvas, the canvas already has a context or already moved, the worker script failed to load, or one side never arrived within timeout.

Fix. Check workerCanvasSupported() and keep a path on the page. Pass a fresh canvas that no code called getContext on. For a timeout, make sure the worker script runs receiveCanvas() and look for its error in worker.addEventListener("error", ...).

WebGPU required or unavailable

WebGPU required WebGPU unavailable WebGPU adapter unavailable No WebGPU canvas

Cause. GPU-only packages refuse the small WebGL2 preview during setup. The full webgl2-compat layer exposes a WebGPU-shaped device and reports backend webgpu. engine.pick and engine.rebootDevice need WebGPU or the preview plugins webglPicking and webglRestore. Engine.create can also report no adapter or a canvas that already has another context.

Fix. Use native WebGPU, or call autoEngine from @margoengine/webgl2-compat/auto with loadCompat: () => import("@margoengine/webgl2-compat") and await package loads inside setup. For the small preview, pass fallback: webglRenderer from @margoengine/webgl2-compat/preview and use packages with real preview routes. Give the engine a fresh canvas that has no 2D or WebGL context.

Geometry unavailable during device restore

Geometry unavailable

Cause. The GPU device was lost and the engine is recreating it; GPU resources cannot be read or created until it finishes.

Fix. Wait for engine.rebootDevice() (or the next frame) to finish, then retry. Packages restore their GPU state in onDeviceRestored.

GPU lost or a GPU validation error

GPU lost: <reason> GPU lost 4 times; reload the page GPU out of memory: <reason> <WebGPU validation message>

Cause. The browser lost the GPU device (driver reset, tab in the background too long, GPU process crash), or WebGPU reported an uncaptured validation error, or a GPU allocation made outside an error scope ran out of memory.

Fix. Core recreates the device itself; recreate textures your code owns (view targets) in onDeviceRestored. Core restores at most 3 times in a row: a fourth loss before 120 frames have drawn since the last one reports failed once and asks for no new device, so reload the page. A validation error names the GPU object at fault: fix the call that created it. Core throws it from the next frame only, then clears it: engine.start() stops its loop on that frame and reports it once through engine.onError, and a new start() draws again. An out-of-memory error is reported once and core rebuilds the device as after a loss; if it repeats, ask for smaller textures, buffers or instance counts.

Render or frame graph re-entered

Render recursion Graph executing Graph recursion

Cause. engine.render was called from inside a frame callback, a plugin hook or a pass, or a pass added passes to the graph or ran the graph while it was executing.

Fix. Call render from your own loop or engine.start(), never from inside a frame. Add or remove passes from registerPasses, setup or outside the frame.

Optional stage package missing

Install <package> to use this stage feature; run npm install <package> and restart the app

Cause. A stage feature such as addGLTF, addViewer or addScene could not import an optional package because it is not installed or the app build cannot resolve it.

Fix. Run npm install <package> with the name from the error, for example npm install @margoengine/gltf. Restart the app; rebuild and redeploy a bundled app so the installed package is included.

Git LFS pointer instead of the asset

<url> is a Git LFS pointer file, not the asset; run git lfs pull and serve the real file

Cause. The server returned a Git LFS pointer, a short text file that starts with version https://git-lfs, in place of a .gltf, .glb, .bin or image. This happens when the repository was cloned or checked out without Git LFS, so the real bytes were never downloaded.

Fix. Install Git LFS, run git lfs pull (or git lfs checkout) in the repository that serves the files, and reload. A host that serves the repository raw must serve LFS objects, not their pointers.

Camera and controls values

Invalid projection Camera at target Vertical camera Invalid frustum Invalid fit Bounds exceed far: raise camera.far Invalid pivot Invalid orbit Invalid pan Invalid projection view offset Invalid projection tiles Invalid projection lens Invalid off-axis screen Invalid off-axis eye Invalid oblique plane Invalid physical camera Invalid wide angle mode Invalid wide angle distance Invalid wide angle view Invalid camera up: pass a nonzero [x, y, z]

Cause. The camera cannot build a view: fov outside 0-180, near not above 0 or far not above near, the position equal to the target, a view parallel to camera.up, a zero or non-finite camera.up for the controls, or non-finite values. fitToBoundingBox needs min <= max, aspect > 0, duration >= 0 and padding >= 1, and a box that fits inside far. Controls need finite input and a camera off its target. @margoengine/cameras also refuses a view offset or tile size that is not above 0, a focal length, film gauge or aspect that is not above 0, an off-axis screen with collinear corners or an eye behind it, an oblique plane the camera is not behind, and a physical camera with an aperture, shutter, ISO, focal length, focus distance or frame rate that is not above 0.

Fix. Keep 0 < fov < 180 and 0 < near < far; move the position off the target; for straight-down views set camera.up (for example [0, 0, -1]) or use CameraProjection from @margoengine/cameras. Raise camera.far for large models. For cameras options, pass whole sizes above 0, put the eye in front of the screen, and keep the camera on the clipped side of an oblique plane.

Transform values

Retained vector: use a transform setter Invalid transform Scale nonzero Quaternion nonzero Invalid poses Invalid transform: <k> Quaternion nonzero: <k> <name>: <n> values <name>: finite values Invalid transform/bounds: <id>

Cause. A position, rotation, scale, quaternion or other vector had the wrong length, a value that is not a finite float32, a zero scale, or an all-zero quaternion. engine.writePoses names the failing row k, refuses a count above ids.length or poses shorter than count * 7, and writes nothing when any row fails. The kernel names the entity whose transform or bounds went non-finite.

Fix. Retained mesh position, rotation and scale refs cannot be replaced: use .set(x, y, z), .setAll(value) or mesh.setPosition, setRotation and setScale. Pass arrays of the stated length with finite numbers; use nonzero scale factors and a nonzero quaternion. Give writePoses 7 numbers a mesh. Look for divisions by zero or NaN upstream of the entity id the kernel reports.

Parents and meshes from another engine or scene

Foreign parent Hierarchy cycle Parent depth: 64 Foreign mesh

Cause. A parent belongs to another engine or scene, would make the mesh its own ancestor, or nests deeper than 64 levels; or the stage was given a mesh of another engine.

Fix. Parent meshes of the same engine and scene, pick a parent outside the mesh subtree, and keep hierarchies under 64 levels. Create meshes with the scene they belong to (scene.createMesh()).

Scenes

Unknown scene: use engine.createScene() Default scene: dispose the engine instead

Cause. A scene from another engine, or one already disposed, was passed in; or engine.scene (the default scene) was disposed.

Fix. Use scenes from this engine: engine.createScene(). The default scene lives as long as the engine: call engine.dispose().

Geometry

Invalid geometry Box size: positive Sphere radius Sphere segments: 3..256 No geometry

Cause. Core geometry accepts three empty arrays, or needs 3 to 1,000,000 vertices, a triangle index count that is a multiple of 3, indices inside the vertex range, and finite positions and normals. Boxes and spheres need positive sizes and 3-256 segments. Fitting needs at least one mesh with geometry.

Fix. Split meshes over 1,000,000 vertices, check index ranges, and pass positive sizes. Give the model meshes with geometry before fitting.

Material values

Invalid material Invalid Color

Cause. A material colour, roughness or metalness was outside 0..1 or not finite, doubleSided was not a boolean, a colour was not #rrggbb or linear [r, g, b], or the material data was changed directly to an invalid value.

Fix. Pass #rrggbb or linear [r, g, b] in 0..1, roughness and metalness in 0..1, a boolean doubleSided, and change values with material.set().

Lighting values

Invalid lighting

Cause. The light direction was zero, or an intensity, radiance or ambient value was negative.

Fix. Use a nonzero light direction and non-negative intensities.

Views, rectangles and picking

Invalid views Invalid view: pass {camera, viewport} Invalid view target: use 1-sample colour Invalid view depth: use the scene depth format and samples, or omit depth Partial-view clear: draw extra attachments with clear: false Invalid draw rectangle Draw rectangle exceeds target Invalid pick

Cause. render({views}) needs a non-empty array of {camera, viewport}. A view target needs 1-sample colour and, if it has a depth, a depth of the same size in the scene depth format and sample count (core draws into it directly and does not convert another format). A pass drawing a partial rectangle with extra colour attachments cannot clear them. Draw rectangles are 4 integers inside the target. pick needs finite CSS pixel coordinates.

Fix. Pass {camera, viewport} objects; use 1-sample target colour; give a target depth the scene depth format (depth32float-stencil8 when the device has it, else depth32float) and sample count (4 with 4x MSAA, else 1), or omit it (a package can resolve the core depth itself with a SceneTarget); draw extra attachments with clear: false; keep rectangles inside the target; pass finite numbers to pick.

Rendering without a page

installGPU needs a gpu with requestAdapter Invalid headless canvas size Headless canvas is not configured readPixels needs an engine on createHeadlessCanvas readPixels needs the WebGPU backend No frame to read: call engine.render() first readPixels reads rgba8unorm or bgra8unorm only Invalid frame count Invalid fps Invalid keyFrameInterval Invalid bitrate Video format: webm or mp4 This codec does not fit this container No video codec is available for this format and size encodeVideo needs WebCodecs No frames to encode Video frames must all be one size Frame data does not match its size The encoder gave no H.264 description encodeWithFFmpeg needs an output file ffmpeg was not found ffmpeg failed Headless stages alive at once share one gpu Images must be one size to compare Invalid threshold Invalid SSIM window Invalid SSIM sigma Invalid compare limits Not a PNG file this reader can use decodePNG needs PNG file bytes Invalid JPEG quality JPEG subsampling: 420 or 444 Image too large for this format Invalid WebP quality Lossy WebP needs OffscreenCanvas This runtime cannot encode lossy WebP EXR type: half or float Install @margoengine/environment readTexture reads rgba16float or rgba32float only

Cause. A @margoengine/headless call got something it cannot use: no WebGPU binding, a size that is not a whole number, an engine on a page canvas or the WebGL2 backend, a read before the first frame, or an HDR format. For video: an empty or mixed-size sequence, a codec its container cannot hold, a runtime without WebCodecs (Node has none), an odd size for H.264, or an ffmpeg that is missing or exited with an error. For comparison: images of two sizes, limits out of range, or a PNG that is interlaced or damaged. For output formats: a JPEG quality outside 1 to 100, an image over the size the format allows, lossy WebP in a runtime with no WebP encoder, an EXR without the environment package, or a texture that is not a float format. Two headless stages alive at once on different gpu objects would fight over the same globals.

Fix. Pass installGPU the gpu from your binding, give createHeadlessCanvas whole sizes from 1, create the engine on that canvas with backend: 'webgpu', and call engine.render() before readPixels or toPNG. HDR output cannot be read this way; leave the canvas format at its default. For video, keep every frame one size, use even sizes for H.264, call encodeVideo in a browser or worker or pass webCodecs, use encodeWithFFmpeg in Node, and read the end of ffmpeg's log in the error's cause. Give headless stages alive at once the same gpu. Compare images of one size, and save an interlaced reference PNG again without interlacing. For formats, use quality in range, encodeWebP without quality for lossless output in Node, install @margoengine/environment for EXR, and read rgba16float or rgba32float textures only.

Pixel camera and layer options

Invalid pixel camera width Invalid pixel camera height Invalid pixel camera minZoom Invalid pixel camera maxZoom Invalid pixel camera zoom Invalid pixel camera position Invalid unitsPerPixel Invalid parallax Invalid fit size Invalid pixel order Invalid pixel layer Invalid pixel layer size Invalid pixel layer anchor Invalid pixel image LayerCompositor needs a camera

Cause. A PixelCamera, LayerCompositor or PixelLayer value is out of range. Sizes and zoom must be whole numbers, because a fractional scale would blur pixel art. Layer fields are read each frame, so a bad one throws from the frame that first reads it.

Fix. Give the camera whole width, height and zoom (zoom from minZoom to maxZoom) and a finite position. Keep a layer's opacity from 0 to 1, its x, y, z, rotation, parallax and pivot finite, blend one of normal, add, multiply or screen, anchor view or world, and pass write bytes of exactly width * height * 4 that fit the target.

Pixel layer state

Pixel layer texture needs an attached compositor

Cause. A layer's texture or target was read before its LayerCompositor was attached to an engine, so there is no device to make the texture on.

Fix. Use LayerCompositor.attach(engine, options), or engine.use(compositor), before reading layer.texture. layer.write works earlier: the picture waits until the target exists.

Pixel-exact backbuffer size

Invalid exactSize

Cause. exactSize was an array that is not two whole numbers from 1 to 8192.

Fix. Pass exactSize: [width, height] in backbuffer pixels (for example [320, 180]), or true to keep the canvas width and height attributes. Zoom with CSS: set the canvas size to a whole multiple and image-rendering: pixelated.

Sprite options and sprite fields

Invalid sprite Invalid sprite rect Invalid sprite tint Invalid sprite camera Invalid sprite capacity Invalid sprite order Invalid sprite clear Invalid sprite pixels SpriteLayer needs an atlas Sprite normal atlas differs in size Too many sprites in a layer Invalid sprite animation Unknown sprite clip

Cause. A SpriteLayer option or a Sprite field is out of range. Sprite fields are read each frame, so a bad value throws from the frame that first reads it: a non-finite position, an alpha outside 0 to 1, or a rect that is not whole texels inside the atlas.

Fix. Keep x, y, z, scale, pivot and rotation finite, alpha from 0 to 1, and rect as [x, y, width, height] in whole texels inside the atlas. camera.zoom must be above 0, tint is 0xrrggbb, #rrggbb or #rgb, atlas bytes are width * height * 4 long, and a normal atlas is the size of the colour atlas. For too many sprites, split them across layers. Animation clips need at least one frame of whole-texel rectangles, positive durations and fps, an event frame inside the clip, a speed and dt of 0 or more, and play takes a clip name you passed in clips.

2D lighting

Lighting2D needs a target Invalid light value Unknown occluder shape Invalid occluder value Lighting2D normals differ in size from the target

Cause. A Light2D field, an occluder or a Lighting2D option is out of range, or the normals texture is not the size of the target.

Fix. Keep light positions and angles finite, intensity, height and softness 0 or more (softness up to 1), radius, falloff and cone above 0, color and ambient as #rrggbb, and camera.zoom above 0. Occluders are polygon, polyline, segment, box or circle shapes with finite numbers. Make normals the size of target.

Palette pass

A palette holds 1 to 256 colours Invalid palette colour Invalid palette value A palette swap has as many colours as its palette PaletteQuantize needs a palette, a source and a target Palette source and target must differ

Cause. A PaletteQuantize option or a palette helper argument is out of range, or the pass was asked to read and write one texture, which WebGPU forbids.

Fix. Pass 1 to 256 colours as #rrggbb or [r, g, b] bytes, a swap of the same length, a known dither and distance, a spread of 0 or more, and two different textures: draw into one pixel layer and show another.

Tile map renderer options

TileMap needs a map TileMap needs atlases Tileset has no atlas Tileset larger than its atlas Invalid tile map order Invalid tile map clear Invalid tile map camera Invalid tile atlas pixels Unknown tile layer Tile outside the layer Tile layer too large for the device

Cause. A TileMap option does not fit its map: a tileset that drawn tiles use has no entry in atlases, its columns, tileCount, margin and spacing reach past the atlas image, a mapLayers or setTile name is not a tile layer of the map, a cell is outside its layer, or camera.zoom is not above 0.

Fix. Pass atlases keyed by tileset name, with images at least as large as the tileset says. Use tile layer names and whole cells inside the layer. Split a layer too large for the device limit maxStorageBufferBindingSize into several.

Tile map renderer state

Image collection tilesets are not drawn Tile atlas lost with the device; call setAtlas

Cause. Drawn tiles belong to a tileset with columns: 0 (one image per tile), which the renderer cannot cut from one atlas, or a map built on a plain GPUTexture atlas drew after a device loss (the texture died with the old device).

Fix. Pack an image collection into one atlas image and set its columns. After a device loss call setAtlas(name, atlas), or pass the atlas as pixels or a function so the map makes it again.

Low-res 3D view

Render3D needs a camera Invalid Render3D size Invalid Render3D value Render3D needs attaching before its view is read Render3D target differs in size A Render3D camera matrix needs an inverse

Cause. A Render3D or renderSpriteFrames option is out of range, its view was read before the plugin was attached, or the target is not the size of the view.

Fix. Attach with Render3D.attach(engine, options) first. Pass whole width and height, a target of that size, an outline color as #rrggbb, and at least one angle.

Sprite layer state

Sprite already in a layer Sprite atlas lost with the device; call setAtlas Sprite normals need one sample and a same-size target

Cause. A sprite was added to a second layer, a layer built on a plain GPUTexture atlas drew after a device loss (the texture died with the old device), or a normal target does not match the colour target.

Fix. Call remove before adding a sprite to another layer. Call setAtlas after a device loss, or pass bytes, an ImageBitmap or (device) => GPUTexture, which come back by themselves. For normals, draw at one sample per pixel (exactSize on the engine, or your own target) with a single-sample normal target of the same size.

Capacity and GPU limits

Capacity: 1..8388608 Capacity Transform allocation GPU buffer limit Shader limit: 64

Cause. The transform store capacity is outside 1..8,388,608, a grow did not raise it, the kernel could not allocate memory, a buffer is larger than the device allows, or more than 64 shader variants were requested.

Fix. Lower capacity, split large geometry, and reuse materials and plugins so fewer shader variants are built.

Wrong argument types

Expected canvas Unknown backend Invalid camera Invalid geometry Invalid material Invalid plugin Invalid pass Invalid delta receiveShadow: boolean Visibility: boolean Box: 3 values Invalid fit: expected a boolean; use true to fit the camera or false to keep its view Invalid stage options Invalid stage onError: expected a function or undefined; pass an error callback or omit onError Expected element shadows: contact, cascaded or false Turntable: finite seconds not 0, finite resumeAfter 0 or more glTF URL must use HTTP(S) Lights: pass an array with type point, spot, area or directional autoReceivers: pass a boolean Hotspot vectors need three finite space-separated numbers reveal: auto or manual

Cause. An argument had the wrong type: not a canvas or element, an unknown backend, a camera, geometry or material not from core, a plugin without a unique name and setup, a pass without a unique name, finite order and execute, a frame delta outside 0..1 seconds, a non-boolean flag, a glTF URL that is not HTTP(S), or addLights input that is not an array of point, spot, area or directional lights.

Fix. Pass core objects (Camera, Geometry, PbrMaterial), a backend of "auto", "webgpu" or "webgl2", plugins and passes with unique names, and booleans for flags.

@margoengine/compute: GPU arrays, kernels and primitives

backward needs a tensor that depends on a parameter; none of its inputs requires a gradient Tensor operands are Tensors, GpuArrays or numbers tensor takes a GpuArray; use gpu.array(data) first An optimizer needs at least one parameter Graph algorithms take a CsrMatrix; make one with graph() Give at least one source vertex autotune needs at least one candidate size autotune measures WGSL kernels, which need a GPU tuneCompute measures WGSL kernels, which need a GPU tuneCompute measures the default kernels; call it before useSubgroups autotune needs a name autotune needs a source and a run function GpuArray disposed; create a new array with gpu.array() GpuArray belongs to another compute context; create it with this context reshape takes at most one -1 dimension Only a contiguous owning array can transfer its buffer write needs a contiguous array; write to the array the view came from ComputeContext disposed; create a new one with createCompute() This GPU has no shader-f16 feature; use 'f32' arrays gpu.array takes a TypedArray or an array of numbers; use gpu.zeros(shape) for an empty array gpu.kernel takes WGSL source text Kernel WGSL has no @compute entry point ComputeContext disposed during a read; keep it alive until reads finish profile() is already running; await it before profiling again gpu.map needs at least one input array gpu.map needs a WGSL expression Engine has no WebGPU device (WebGL2 fallback); create the context without an engine WebGPU unavailable; use a runtime with WebGPU, or backend: 'cpu' WebGPU adapter unavailable; check that the GPU is enabled, or use backend: 'cpu' f16 data needs Float16Array; read it as f32 with astype("f32") Compute arrays take number TypedArrays, not BigInt arrays or DataView bitcast needs a 32-bit type; astype f16 to f32 first where needs a condition array or expression fft takes a real array or { re, im } arrays fft re and im must have one shape fft needs at least one dimension ComputeFrame disposed; attach a new one ComputeFrame is not attached; call ComputeFrame.attach(engine) ComputeFrame needs the WebGPU backend; the engine runs WebGL2 trackNext needs WebGPU; this page has no GPUAdapter ComputeFrame.add takes a bound kernel: gpu.kernel(code).bind(resources) ComputeFrame.add needs run options ({ count }, { workgroups } or { indirect }) or a function returning them histogram takes a GpuArray or an Expr indirectOffset must be a whole number of elements Kernel run needs count (threads), workgroups or indirect Kernel disposed; compile it again with gpu.kernel() BoundKernel disposed; bind the kernel again matmul takes two GpuArrays or Exprs matmul operands belong to different compute contexts matmul needs arrays of at least one dimension; use mul for scalars choice takes a GpuArray Reductions take a GpuArray or an Expr scan takes a GpuArray or an Expr segmentedScan takes values and flags as GpuArrays or Exprs Indices must be a GpuArray or an Expr Indices must be integers; astype('i32') first take reads a GpuArray or an Expr take from an empty axis has nothing to take scatter writes into a GpuArray scatter needs a contiguous target; scatter into the array the view came from scatter add/min/max needs a 32-bit target; use 'f32' scatter values must be a number, a GpuArray or an Expr bincount needs length (the number of bins, one past the largest value) as a whole number compact takes an input and a mask (GpuArrays or Exprs) convolve takes two GpuArrays or Exprs convolve takes a 1-D kernel; use convolve2d for images convolve needs a signal of at least one dimension convolve needs non-empty signal and kernel convolve2d takes two GpuArrays or Exprs convolve2d takes an image of at least 2 dimensions and a 2-D kernel convolve2d needs non-empty image and kernel sort takes a GpuArray or an Expr Sort bits below 32 apply to u32 keys only; drop bits for other types sortByKey values must be a 32-bit type; astype("f32") first sortByKey values must be a GpuArray or an Expr quantile of an empty array has no answer stream takes an iterable or async iterable of TypedArrays stream needs a function to run on each chunk histogramStream needs a fixed range so chunks share bins A custom operator needs WGSL strings combine (of a and b) and identity grad takes an output GpuArray or Expr grad takes the arrays to differentiate by as a list of GpuArrays grad seed belongs to another compute context grad seed must be a number, a GpuArray or an Expr grad by a view is not supported; pass the array the views came from CsrMatrix disposed; create a new one with csr() or coo() matvec takes a GpuArray or an Expr A sparse matrix needs shape: [rows, cols] spmv takes a CsrMatrix; make one with csr() or coo() CPU Wasm runtime is disposed CPU Wasm packet exceeds 8,388,608 f64 words; process smaller chunks decomp needs an array [..., rows, columns] decomp matrix dimensions are limited to 4096 solve needs a compute array or expression as its RHS Seeds must be a GpuArray (or an expression) of a 2D or 3D mask solve, inv, det, cholesky and eigh need square matrices fullMatrices must be boolean; maxSweeps must be an integer in 1..1000 solve operands must share a context; b needs at least one dimension solve RHS rows must match A decomp workspace allocation rejected Dense decomposition result exceeds f32 range Concatenation needs at least one tensor; supply inputs Recurrent states must use the input context; move the state first Normalization eps must be finite and positive; choose e.g. 1e-5 BatchNorm momentum must be null or in [0,1]; choose a valid weight BatchNorm input must share its context and channel dimension; use the configured axis BatchNorm training needs more than one value per channel; use eval() or a larger batch State batchesTracked must be a nonnegative integer; supply the saved normalization state GroupNorm channels must be divisible by groups; choose a common divisor GroupNorm needs [batch, channels, ...spatial] in its context; check channels Transposed convolution channels must divide into groups; choose a common divisor outputPadding must be less than stride or dilation; choose a smaller value ConvTranspose2d needs [batch, inChannels, h, w] in its context; check input channels Transposed convolution output size is outside its stride range; use the inferred output size Upsampling needs [batch, channels, 1..3 nonempty spatial axes]; reshape the input Interpolation mode must match the spatial rank; use nearest or linear Choose either size or scaleFactor for upsampling Upsampling sizes/scales must be positive and match spatial rank; supply one per axis Recurrent dropout must be in [0,1); choose a valid probability Recurrent input needs [time,batch,inputSize] in its context; check batchFirst and features Initial recurrent states need [layers*directions,batch,hidden]; use the layer state shape GRU has no cell state; pass only h Sequence lengths need one integer in [0,time] per batch item; supply valid lengths ONNX tensor exceeds 16777216 elements; split the tensor ONNX model is disposed; load a new session ONNX empty scan needs static element shape information; export static scan output dimensions ONNX SequenceMap exceeds maxIterations; increase its safety bound ONNX Loop reached maxIterations; increase its explicit safety bound ONNX Scan exceeds maxIterations; increase its explicit safety bound ONNX session is already running; await its run or use another session ONNX inference reached maxNodes; increase its explicit work bound Use Int8Array for signed quantized input Shape operations need a compute array or expression concatenate/stack needs at least one array Use axis: null to concatenate scalars Shape operands must share a compute context concatenate needs matching dimensions outside its axis; stack needs identical shapes flip axes must be distinct; remove repeated axes tile repetitions must be nonnegative safe integers repeat needs one nonnegative integer or one count per element of its axis repeat result exceeds the signed index limit; split the input pad needs nonnegative [before, after] widths for each input dimension pad mode must be constant, edge, wrap, reflect or symmetric Nonconstant padding needs nonempty input axes; use constant padding

Cause. A compute call got something it cannot use (an argument of the wrong type or shape, an array from another context or already disposed, a view where a contiguous array is needed, a WGSL kernel without an entry point, missing or unknown bindings), the device lacks a feature (WebGPU, shader-f16), or queued GPU work failed: a WGSL error in a kernel, map expression or custom operator, or out of memory. GPU failures are reported by the next wait (read, item, done, filter) as code failed with the GPU diagnostic in the message.

Fix. Read the message: it names the fix. Create arrays with the same context (gpu.array, gpu.zeros), keep them alive until reads finish, call ascontiguous() before binding a strided view to your own kernel, pass every binding the kernel declares by its WGSL name, and fix the WGSL the diagnostic points at. Without WebGPU, feature-test navigator.gpu and offer a CPU path; branch on error.code.

@margoengine/sciviz: figures, layers and colour maps

Geographic flow needs ascending longitude/latitude degrees within the open poles and nonnegative metre heights Geographic flow exceeds 8000000 samples; reduce dimensions Geographic flow needs one east/north/up value per grid sample Atmosphere needs an invertible figure model; use nonzero aspect Atmospheric globe needs a perspective camera; choose perspective projection Globe disposed during flow creation; keep it alive until settlement Globe points need lon/lat/height triples, one value each and radius 0..1000000 m Atmospheric globe disposed; create a new one Flow draw projection must be globe or omitted Flow velocities must be finite or NaN; remove infinite samples maxBytes must be an integer of at least 32 File response has an incorrect Content-Range File response has no body File response exceeds the bounded read File response length differs from Content-Range A file needs a URL, bytes or a FileSource File read is outside the safe byte bound FileSource returned an invalid byte range VTK count exceeds file bound VTK 5.1 CELLS requires OFFSETS VTK 5.1 CELLS requires CONNECTIVITY VTK 5.1 offsets must span connectivity VTK 5.1 offsets must be increasing integers Derived flow needs three positive integer dimensions and six finite bounds Derived flow supports at most 1000000 grid points per snapshot Derived flow needs equal singleton bounds and finite normal float32 inverse spacing on active axes Derived flow components and mask must match the grid point count Derived flow mask values must be finite Derived flow velocities must be finite float32 values or NaN for missing data Derived flow float32 stencil envelope 8 * max(maxAbsVelocity, 2^-126) * maxAbsInverseSpacing must not exceed 1e18; rescale units Derived flow needs eight storage bindings and a gradient buffer of 36 bytes per point within device limits Derived flow eigensolver did not converge within its float32 residual bound Path needs an array of packed xyz positions Closed must be a boolean Path has consecutive duplicate points; remove repeated samples Closed paths need at least three distinct points and an exact repeated endpoint Closed path scalar must match at the repeated endpoint Path reverses at a cusp; split it into separate paths Sweep overflows or has an undefined normal; reduce coordinates or split the path Caps must be a boolean Tube exceeds one million vertices; reduce steps or sides Stream mesh needs finite xyz, normals and scalar per vertex and valid triangle indices Stream triangle output exceeds 128 MiB; reduce sweep steps or sides Vorticity twist needs positive physical speeds at every input point Ribbon speeds must be positive; split at stagnation Ribbon angle must be finite radians Ribbon twist exceeds 1e12 radians; split the path or check speed units Closed ribbon physical twist must be a whole number of full turns; split it at the seam Streamline needs a positive finite step, nonnegative integer maxSteps/minSpeed and a valid direction Create a new LIC layer after disposal Await figure.ready() after LIC device replacement LIC readback timed out; check GPU/device state LIC phase must be finite LIC dims need x/y >= 2 and z >= 1 integer samples LIC bounds need six finite coordinates LIC bounds must ascend on sampled axes and be equal on singleton z LIC copied field must fit the 128 MiB working budget LIC resolution needs two integer dimensions in 8..2048 LIC steps, step, seed, contrast and opacity must lie in their documented ranges LIC animated and coloured options must be booleans LIC components and scalar need one number per field node LIC slice needs finite xyz origin and edges within +/-1e15; use local coordinates LIC slice edges must be independent, with sin(angle)^2 > 1e-8 LIC slice must lie in the singleton z plane LIC slice mapping exceeds float32 arithmetic headroom; use local coordinates LIC samples must be finite or NaN LIC samples exceed +/-1e30; rescale field units LIC colour range needs representable float32 ratios; rescale scalar units LIC scalar range overflows float32; rescale scalar units LIC nonzero field nodes must retain eight float32 normal units after common scaling; split fields with excessive dynamic range LIC image or field exceeds device buffer limits; reduce grid or resolution LIC readback timeoutMs must be positive and <=2147483647 Marching cubes Wasm could not load; serve valid package assets CPU isosurface dims need three integers of at least 2 samples CPU isosurface level must be finite in float32 CPU isosurface input and cases exceed the 2 GiB working-memory limit; use a coarser grid CPU isosurface vertices exceed the 2 GiB working-memory limit; use a coarser grid Flow Wasm could not load; serve valid package assets Flow memory could not grow; use a smaller grid or fewer frames Flow streakline needs 1..4096 strictly increasing release times at or before to Flow device changed during creation; create on the restored figure Create a new flow layer after disposal Await figure.ready() after device replacement Await the current flow operation before advancing Flow operation lost ownership after device replacement Flow readback timed out; check GPU/device state Flow seeding needs a valid kind, count, seed and in-grid bounds or endpoints Flow trails need 2..256 samples and maxSteps needs 1..1000000 Flow count, lifetime, width and opacity must lie in their documented ranges Flow respawn must be a boolean Flow initial time must lie in the frame range GPU flow bounds and sampled widths must be representable in float32; use local coordinates GPU flow buffers exceed the device limit or 128 MiB; reduce grid, frames, count or trails GPU flow velocity exceeds float32 arithmetic headroom; rescale distance/time units Flow color needs a hexadecimal sRGB colour Flow advance needs a covered forward time and positive finite step Flow maxSteps recovery budget exhausted; create a new layer Flow step cannot advance this time value in float32; use relative times or rescale units GPU flow step/velocity product exceeds float32 arithmetic headroom; reduce step or rescale units Flow readback timeoutMs must be positive and at most 2147483647 Use WebGPU or webgl2-compat Figures need WebGPU or the WebGL2 compatibility layer; on a browser without WebGPU use createFallbackFigure from '@margoengine/sciviz/fallback' Attach SciRenderer first Bricked volume disposed; create a new one A bricked volume needs range: [min, max], from the option or the source A bricked volume needs a source: { dims: [nx, ny, nz], read(request) }, or arraySource(data, dims) arraySource needs dims: [nx, ny, nz] Colormap needs a sample(t) function returning [r, g, b] A custom colour map needs at least two stops Colour map stops are [t, colour] pairs or colours Figure aspect must be three positive numbers Figure disposed; create a new one replace needs two layers belonging to this figure scatter takes { x, y, z?, color?, size? } or { positions } scatter positions must hold x, y, z per point scatter x, y and z must have one length line x, y and z must have one length of at least 2 select takes { rect: [x0, y0, x1, y1] } or { polygon: [x, y, ...] } bar x and y must have one length of at least 1 histogram takes an array of numbers or a TypedArray Heatmap x and y must be above 0 on a log axis quiver x, y, z, u, v and w must have one length of at least 1 streamlines found no flow at the seeds; check bounds and seeds timeline needs at least one time timeline needs a frame callback (index, time) => void timeline times must be finite numbers Timeline disposed; create a new one play needs a timeline: call figure.timeline(times, frame) first Isosurface GpuArray must live on the engine device: createCompute({ engine }) Isosurface disposed; create a new one Device replaced; request the isosurface again sciviz needs the WebGPU backend; the engine runs WebGL2 sciviz renderer is not attached; create a Figure on an engine project needs finite lon, lat and height Tile images need an OffscreenCanvas 2D context Tile zoom must be a whole number from 0 to 24 tileLayer needs tiles: a URL template or a function Graph edges hold two node indices per edge Graph weights hold one value per edge Graph layout dimensions are 2 or 3 Graph layout length > 0, theta >= 0, cooling in (0, 1], gravity >= 0 and simmer >= 0 Graph edgeOpacity must be in [0, 1] Graph nodeSize must be above 0 Graph layer disposed; create a new one values: 'cell' needs the grid's cellData An unstructured grid needs points, connectivity, offsets and types Grid points must hold xyz per point Grid offsets do not end at the connectivity length A slice plane needs a non-zero normal and a finite offset VTK file ends early Not a legacy VTK file: the first line must be "# vtk DataFile Version x.x" VTK file needs a DATASET line after its format VTK CELL_TYPES count differs from CELLS A VTK UNSTRUCTURED_GRID needs POINTS, CELLS and CELL_TYPES VTK CELLS size differs from its cells Mesh opacity must be in [0, 1] Mesh range must be [min, max] with min < max Mesh layer disposed; create a new one A triangle set needs xyz, a normal and a value per corner, three corners per triangle NIfTI-2: the signature after the magic is not 0D 0A 1A 0A (the file went through a newline conversion) NIfTI: vox_offset is not a finite number DICOM: a sequence runs past the end DICOM: a sequence holds something other than items DICOM: the elements of an item overrun its length DICOM: the File Meta Information Group Length (0002,0000) runs past the end DICOM: the file meta elements overrun the File Meta Information Group Length DICOM: a Modality LUT Sequence needs exactly one item DICOM: the Modality LUT needs a LUT Descriptor of three values and LUT Data DICOM: LUT Data does not hold the entries its descriptor gives DICOM: bytes follow the end of the deflated data set DICOM: Float Pixel Data needs BitsAllocated 32 DICOM: Double Float Pixel Data needs BitsAllocated 64 DICOM: 32-bit OW pixel data in explicit VR big endian is not read (PS3.5 A.3 leaves its word order open) DICOM: YBR_FULL_422 needs SamplesPerPixel 3 and PlanarConfiguration 0 DICOM: YBR_FULL_422 with an odd number of columns is not read DICOM: the file has both a Modality LUT Sequence and Rescale Slope or Intercept dicomSeries: the images differ in their number of frames openZarr: path is not a string Zarr: storage_transformers is not a list Zarr: codecs is not a list holding the bytes codec Zarr: attributes is not an object Zarr: filters is neither null nor a list Zarr: compressor is neither null nor an object with an id Zarr: a bool chunk holds a byte other than 0 or 1 NIfTI: shorter than a header NIfTI: sizeof_hdr is neither 348 nor 540 NIfTI-2: shorter than a header NIfTI: a .hdr header needs resolve to read its .img DICOM: a sequence or item has no delimiter DICOM: an element runs past the end DICOM: the file has no pixel data DICOM: encapsulated pixel data in an uncompressed syntax DICOM: Rows and Columns are missing dicomSeries needs at least one image dicomSeries: the slices differ in size; pass the images of one series dicomSeries: the images come from more than one series (SeriesInstanceUID) openZarr takes a URL, an object of keys or a function Zarr: chunk shorter than its crc32c Zarr: a chunk fails its crc32c check Zarr: shape and chunks do not match loadNRRD takes a URL, an ArrayBuffer or a typed array A GpuArray surface needs range: [min, max] (read it with z.min().item()) This surface reads a GpuArray; write to the GpuArray instead A GpuArray volume needs range: [min, max] (read it with data.min().item()) Volume density and quality must be positive A clip plane is { normal: [x, y, z], offset } with finite numbers Volume GpuArray must be contiguous f32; pass data.astype('f32').eval() Volume GpuArray must live on the engine device: createCompute({ engine }) Sonification needs numeric values; supply an array-like source Sonification needs 1..maxPoints records; choose a data window or raise maxPoints Sonification needs duration in (0,600] and increasing pitch bounds in [20,20000] Hz; correct options Sonification has no finite values; supply an observed series Sonification range must be finite and ordered; correct range Source times must be finite, strictly increasing and match values; correct times Sonification volume must be in [0,1]; correct volume Web Audio is unavailable; use a browser with AudioContext Accessibility pageSize must be 1..1000; correct pageSize Focus requires an existing series and record index; choose a listed record Accessible series needs a nonnegative integer count and datum(index); correct adapter No accessible series; await refresh or supply an adapter Series exceeds sonification maxPoints; choose a window or raise maxPoints Raster aggregation requires a 2D figure Raster binding is disposed Invalid raster shading reduction, transform, spread or density Unknown raster shading category Shade range must be finite and ordered Raster numeric columns need exactly representable JavaScript values; rescale int64 columns Raster needs a known glyph, increasing finite bounds, dimensions 1..4096, at most 1048576 bins and chunkRows 1..65536 Raster coordinates and values must be numeric Raster category needs a dictionary-encoded column Categorical raster exceeds 16777216 bin/category cells; partition the categories Exact raster accumulator exceeds this GPU storage binding limit; reduce raster dimensions Annotation needs an ID, a known kind and the required finite 3D handles Annotation width must be positive and finite Annotation color must be #rrggbb Annotation offset needs two finite CSS pixels Annotation text must be a string Annotation unit must be a string Annotation visibility must be boolean ROI point must be finite xyz ROI membership needs a box or sphere annotation Volume picking needs finite ray, exact dimensions >=2, data and sample-centre bounds Volume pick bounds need a nonzero extent on every axis Grid picking needs a finite nonzero ray Figure already has annotations; reuse its controller Physical annotations need linear axes; use a linear figure Annotation IDs must be unique Annotations disposed; create a new controller Annotation ID already exists; use update Unknown annotation ID; add it first Restored annotations need unique IDs Choose an existing annotation handle Comparison frame must contain dimensions and RGBA8 pixels; await the complete readback Comparison dimensions must be positive safe integers; pass copied RGBA8 pixels Comparison pixels must contain width * height * 4 bytes; copy the complete frame Comparison pixels must be Uint8Array or Uint8ClampedArray; convert the readback to RGBA8 Comparison frame dimensions differ; use the same pixel dimensions on both renderers Comparison runs must be 1..100 and warmup 0..20; pass bounded pair counts Comparison renderers need an async frame method; return copied RGBA8 pixels Comparison timing must be boolean; omit it for a clock-free smoke Use unique nonempty categories, a finite nonzero range and paddingInner in [0,1) Use jitter width in [0,1] and an integer seed Supply an RGB/RGBA image with integer dimensions and at most 1048576 pixels Use an increasing finite image extent [xmin,xmax,ymin,ymax] Image channels must be integer bytes in [0,255] Cluster 1..256 equally sized finite vectors with single, complete or average linkage Rescale cluster values so Euclidean distances are representable Use a complete hierarchical clustering result Use backward cluster references and finite distances Use a nonempty matrix with at most 256 columns Analysis grid needs xyz points, connectivity, cell end offsets and VTK types Analysis grid connectivity and scalar arrays must match their point and cell counts Ambient occlusion needs positive radius, 1..64 directions and 1..256 steps Volume shadows need 1..2048 steps Path tracing needs HG g in (-1,1), 1..32 bounces, albedo [0,1], integer samples/uint32 seed Lighting needs a finite nonzero direction and nonnegative finite RGB radiance Cinematic volume is disposed Cinematic lighting requires composite volume mode Cinematic density and quality must be finite and positive Cinematic volume transform must be invertible Render the cinematic volume before reading cost Named analysis arrays must use a nonempty name; default scalars use pointData/cellData Analysis coordinates must be finite sourceCells must contain one unsigned 32-bit ID per cell An analysis image needs three positive dimensions and six finite bounds Analysis images must have two or three active axes and at most 1000000 samples Structured points must contain xyz per sample Image singleton bounds must agree, and active-axis bounds must differ Select a scalar array with one value per associated point or cell Threshold needs an ordered range (infinite ends allowed), point/cell association and all/any point mode Select an array with complete tuples per associated point or cell Clip needs plane, box, sphere or scalar shape Clip plane needs a finite nonzero normal and finite offset Clip sphere needs a finite center and positive finite radius Scalar clip value must be finite Clip box needs six finite ordered bounds Clip scalar/implicit values must be finite; rescale coordinates or select valid data Iso-volume needs a finite ordered scalar range Subset needs three inclusive index ranges within the image and positive integer strides Connectivity extract must be all, largest, regions, closest, pointSeeded or cellSeeded; order descending, ascending or first Connectivity scalarRange must be an ordered pair Connectivity closest needs a finite xyz point Clip pipeline params need clip, threshold, connectivity, isoVolume or image subset operation Cloud Blosc requires the standard Blosc1 header and shuffle filters; transcode the chunk N5 LZ4 block stream is damaged; check its lengths and checksum Precomputed hash needs an identity-hashed scale; choose that scale Cloud path must be relative; remove URL escapes and dot segments Cloud maxBytes must be at least 32 Cloud URL must use HTTP, HTTPS or S3 Cloud response has an incorrect Content-Range; check the server Cloud response has no body; check the server Cloud response exceeds maxBytes; use smaller chunks or enable Range Cloud response is truncated; check the server Cloud store needs a URL, key map or get function Cloud range must be safe, bounded bytes; use a negative length for a suffix Cloud store returned too many bytes; obey the requested bound Colour needs three finite sRGB channels in [0,1]; supply #rrggbb or [r,g,b] Colour scale needs a domain [min,max]; supply two limits Colour scale needs increasing finite limits, a positive log domain and constant; correct the options Choose boundaries or bins, not both Colour bins must be a whole number from 1 to 256; correct bins or boundaries Bin boundaries must strictly increase from domain minimum to maximum; correct the edges Supply exactly one colour per bin Unknown Tol scheme; choose a tolSchemeNames entry Contours require one scalar pointData value per point Contour coordinates, scalars and levels must be finite float32, zero or magnitude 1e-18 to 1e18; rescale units Contours support up to 1000000 points and 256 levels per request Contours exceed 10000000 output vertices; request fewer levels or a subset Contour pipeline params require levels Delaunay sites must have distinct coordinates Delaunay sites must not all be collinear Inverse mapping needs eight finite xyz corners and a finite point Spherical axes need increasing finite samples, positive radius and valid radian angles Spherical centre needs three finite coordinates Structured volume needs finite xyz at every node, three dimensions >=2 and nonzero physical bounds Curvilinear cell is singular or folded; supply an injective grid Mapped volume needs one finite scalar or NaN mask per node, and at least one finite scalar Reference step must be finite and positive Mapped topology exceeds this GPU texture limit; reduce the grid Mapped volume density and quality must be finite and positive Mapped volume is disposed Outline needs an integer stride >=1 and RGB in [0,1] Slice index must lie on the chosen grid axis Section opacity must be in [0,1] Unknown CVD type; choose protan, deutan or tritan CVD severity must be finite in [0,1]; correct severity CVD input needs three sRGB channels in [0,1]; correct rgb Density needs count/kernel mode, bandwidth in (0,32], opacity in [0,1] and a hex colour Density dimensions must be 2d or 3d The scatter must belong to this figure Remove the existing scatter replacement before attaching density Density needs interleaved xyz with at most 4294967295 points Density needs WebGPU or createFallbackFigure Create a new density layer after disposal Density raster exceeds device storage limits, 8192 per axis or 16777216 pixels; reduce canvas resolution Density needs complete xyz positions within u32 count range Density needs storage for at least one xyz point Density read timeout must be finite and positive Render the figure before reading density counts Density layer was disposed Image format must be png or webp maxBytes must be positive and quality must be in [0, 1] WebP exceeds its dimension or maxBytes limit; use PNG or reduce the size This browser cannot allocate the WebP output canvas Timeline export needs an inclusive valid frame range and fps in (0, 1000000] Image sequence exceeds classic ZIP entry limit Image sequence exceeds maxBytes Video frame exceeds maxBytes; reduce output dimensions Set finite positive SVG dimensions, a finite 4x4 matrix and colorDepth in 0..4 Geometry needs complete xyz primitives, RGBA per vertex and positive CSS widths; repair the input Vector colours must be finite sRGB RGBA in 0..1; convert the input colours createFallbackFigure needs the compatibility layer; pass { compat: await import('@margoengine/webgl2-compat') } Figure theme must be dark, light or a Theme; supply chrome colours Theme scalarMap needs a named colour map; choose colormapNames Theme needs chrome colours; supply a Theme object Figure limit space must be data or plot Figure limits must be in the domain of their axis scales Custom layer dimensions must be 2d or 3d Update a native line/scatter created by this Figure Use per-point sizes with a scatter trace, not a line Keep the original layer in this Figure until its update completes FITS alternate WCS must be A..Z or empty FITS WCS axis count is invalid FITS WCS pixel is incomplete or nonfinite FITS SIP order is invalid FITS non-default celestial pole rotation is not supported Set digits to an integer from 0 to 15 Choose a supported number format mode Supply an increasing domain, disjoint interior breaks and a total gap below .8 Use increasing finite major ticks and minor count from 0 to 100 Reuse the existing chart controller or dispose it first Create a 2D Figure before polishing chart axes Attach chart polish before adding images or heatmaps; existing traces must be lines or scatter Use nonempty unique categorical axis labels Place the figure canvas in a positioned container Add the live trace through this chart controller before binding it Create a new chart polish controller after disposal Configure secondaryY before adding a secondary trace Use a finite increasing data zoom range Choose a layer belonging to this figure Use an acyclic inset hierarchy Remove an inset from its current parent before attaching it again Use a distinct inset and a positive rectangle inside [0,1] Use positive finite range-selector spans Terrarium needs width * height RGBA bytes Tile decode needs OffscreenCanvas 2D Stream source needs zoom 0..24, tileTexels 2..1024 and integer origin Quantized height grid size must be 2..1024 Quantized terrain triangles do not cover the tile Tile cache needs positive capacity and concurrency 1..64 Cache capacity must exceed the selected tile budget for root fallback Tile clock must be finite seconds Tile view needs a finite 4x4 matrix and positive viewport Tile selection needs maxZoom 0..24, tileBudget 1..65536 and positive tilePixels Tile mesh needs segments 1..256 and nonnegative skirt metres Elevation dimensions must match finite height samples Geo LOD needs tiles, a projection, nonnegative fadeSeconds and cacheTiles greater than tileBudget SGP4 mean orbit is invalid at this time; use a newer element set SGP4 perturbed eccentricity is invalid; use a newer element set SGP4 semilatus rectum is negative; use a newer element set SGP4 satellite has decayed below the Earth reference ellipsoid Track id must be a string or finite number Track needs increasing finite times and packed lon/lat/height with latitude -90..90 Track time must be finite Unknown geographic interpolation Trail time and nonnegative duration must be finite WMTS time needs finite UTC milliseconds and a valid XYZ tile WMTS time dimension and formatted time must be nonempty Time rasters need increasing valid UTC milliseconds and cacheFrames 1..16 Raster seek needs finite UTC milliseconds Time raster disposed; create a new layer Topology needs an object; supply valid TopoJSON Topology coordinates/arcs need arrays; supply valid TopoJSON Topology exceeds maxBytes; raise the input budget Topology JSON is invalid; supply a complete JSON object Expected type Topology; use parseGeoJSON for GeoJSON Topology scale/translate need two finite numbers Topology positions need at least two finite coordinates Topology exceeds maxVertices; raise the geometry budget Quantized topology coordinates must be safe integers Topology delta accumulation exceeds safe integers; use a smaller quantization grid Topology transform overflows; supply finite transformed coordinates Topology arc index must be a safe integer Topology arc index is outside arcs; supply a complete topology Topology arcs need two positions Topology arc endpoints do not match; repair the shared boundary Topology stitched path exceeds maxVertices Topology nesting exceeds maxDepth; flatten the geometry collection Unknown topology geometry type; supply a specified geometry Topology nesting exceeds maxDepth; flatten collections Topology exceeds maxFeatures; select fewer objects Trips need tracks, nonnegative finite trail duration and fadeSteps 1..64 Trip IDs must be unique Trip time must be finite Trips layer disposed; create a new layer Vector JSON exceeds maxBytes; raise the input budget Vector JSON is invalid; supply complete JSON text TopoJSON needs JSON text or an object Geographic MVT needs bytes and an XYZ tile address Unknown vector format; choose geojson, topojson or mvt Join keys must be strings or finite numbers Vector nesting exceeds maxDepth; flatten geometry collections Vectors need a projection, maxDegrees in (0,180], positive vertex budget and finite height Vectors need WGS84 degrees; supply MVT tile or reproject first Vector tessellation exceeds maxOutputVertices; raise the budget or maxDegrees Vector lines exceed maxOutputVertices Arc needs segments 1..100000 and finite arch metres Arc endpoints need finite lon/lat and optional height, latitude -90..90 Arc height overflows; reduce endpoint heights or arch Binning needs positive projected size, stride 2 or 3, and one value per position Binning values must be finite; filter missing observations first Bin sum overflows; rescale observations before binning Vector style needs nonnegative pixel sizes, opacity 0..1, one value per feature Vector colours need three sRGB components in 0..1 Vector layer disposed while loading labels Glyph layer disposed; create a new layer GPU bundling needs WebGPU or compatibility; use bundleGraphEdgesReference on CPU GPU graph layout requires a WebGPU or compatibility device; use GraphLayoutReference on CPU Graph layout disposed; create a new layout Mesh is disposed; create a new layer before export Use raster export for custom transport or scalar-opacity meshes Isosurface is disposed; create a new layer before export Labels need distinct uint32 IDs, RGBA in [0,1] and outline width 1..16 A fusion volume needs three integer dimensions >=2 and a finite nonnegative weight Fusion bounds must be finite and increasing Volume transform must be a finite affine 4x4 matrix Volume transform must be invertible and affine Volume transform is outside the GPU float range Label data length must equal nx*ny*nz Label voxels must be exact uint32 integers Fusion data needs 1..4 complete interleaved components per voxel Components need finite increasing ranges and nonnegative weights Component functions must return linear RGBA in [0,1] Colour volumes need positive scale and opacity in [0,1] Fusion voxels must be finite; mask missing samples before drawing RGB/RGBA channels must lie in [0,scale] A fusion march takes 1..4 sources Fusion needs optical/over/maximum mixing and positive finite quality/density Fusion source exceeds GPU texture dimensions; reduce the source or category count Select a label source index Fusion layer is disposed Legend size must be in (0,256] CSS pixels; correct size Unknown legend shape; choose a LegendShape Bind a layer belonging to this figure Selection masks require WebGPU or webgl2-compat Pass rowIds or groups, not both One row key or group is required per mark Unknown selection display mode Selection fade must be in [0,1] The layer and its drawn marks differ in count The layer is already bound; dispose that binding first Selection row keys must be strings or finite numbers Selection dataset row keys must be unique Unknown selection universe Unknown selection resolve rule Selection history must be a nonnegative integer Invalid selection state; use a version 1 snapshot Invalid brush history; supply ordered brush arrays Invalid brush keys; use unique sources and dataset row IDs Selection history exceeds its limit; correct the saved history SelectionStore is disposed Unknown selection operation Use a positive finite math size in pixels per em Attach the figure canvas before adding a math label. Math label coordinates must be finite. Image tiles must cover rows in order without gaps PNG strip exceeds maxBytes; reduce tileSize Invalid tile dimensions Image tiles did not cover the complete image Compressed PNG exceeds maxBytes This browser cannot encode WebP Browser returned an incomplete WebP file ZIP exceeds 65535 entries Image sequence exceeds classic ZIP limits Image sizes and scale must be positive finite numbers; dpi must be in (0, 1000000] Choose a physical size or a scale, not both Image size unit must be px, mm or in Image dimensions must round to positive 31-bit integers A media capture is already active on this engine Tiled export needs WebGPU or the WebGL2 compatibility layer tileSize must be a positive integer Tile readback exceeds maxBytes or the device buffer limit; reduce tileSize Sweep sizes must be strictly increasing positive safe integers Invalid sweep budget, sample count or timeout Sweep CPU load must be a fraction in [0, 1] Figure stats is disposed Figure already has a different stats property Multi-volume density must be finite and at least 0, quality finite and above 0 Multi-volume is disposed; create a new one multiVolume needs a Figure; create one with Figure.create Notebook buffers must be a dictionary of binary attachments Notebook attachments must be binary comm views Notebook selection needs a region and layer/index points Notebook selection must address an existing scatter or line layer Notebook selection indices need uint32 bytes Notebook selection indices must be unsigned 32-bit integers Notebook height must be an integer from 100 to 4000 pixels Notebook backend must be auto, webgpu or webgl2 WebGL2 requires prepareBackend; supply an async callback calling the compatibility layer install(options) Density needs width >= axis count, height >= 2, dimensions <= 8192 and at most 16777216 pixels Scatter-matrix size must be finite and positive Multivariate GPU plots require WebGPU or the WebGL2 compatibility device Multivariate columns exceed this device storage binding limit; partition the table Multivariate plots need 2 to 32 distinct column axes Multivariate plot exceeds its row/draw-index limit; partition the table Multivariate rowIds must match the table length Axis scale must be linear or log Categorical axes need a linear scale Axes need increasing finite domains, positive for log Every multivariate row key must exist in the shared selection MultivariatePlot is disposed; create another plot Axis order must be a permutation of the plotted columns A brush needs ordered finite endpoints Matrix brush ranges need ordered finite endpoints Density belongs to a parallel-coordinates plot Non-finite SVG coordinate. Supply finite coordinates. Use a positive finite PDF widthMM. GPU picking needs WebGPU or createFallbackFigure Use finite coordinates, radius >= 0, opacityThreshold in (0,1], timeout > 0 Create a new GpuPicking after disposal GPU picking supports at most 2^32 voxels per layer; split the volume GPU pick input exceeds maxBufferSize; split it into multiple layers Use finite positive volume quality and nonnegative density before picking Pipeline params must be acyclic finite JSON; use plain values Pipeline params must use plain objects; store data in a source operator Invalid pipeline operator; provide a kind and execute function Pipeline node ID must be a unique nonempty string; choose another ID Sources need no inputs and filters/layers need inputs; correct the connections Pipeline time must be finite; provide a finite step Unsupported pipeline JSON; use version 1 with a nodes array pointBudget must be a positive integer at least the source root count fade must be between 0 and 1 origin must contain three finite coordinates attribute component must be a nonnegative integer pointBudget must be at least the source root count pick needs finite pixels and a nonnegative radius Point cloud layer is disposed Unknown point cloud format Probe image needs three positive dimensions and six finite bounds Curvilinear points must match image dimensions Probe image active bounds must differ and singleton bounds must agree Probe inputs support at most 8000000 points per snapshot Probe named arrays must use nonempty names Probe arrays must hold complete tuples matching their associated count Default probe pointData/cellData must be scalar Probe points must be finite Cell locator is disposed; create a new one Probe position must be finite xyz Line probe needs finite xyz vertices and 2 to 1000000 samples Line probe must have positive length Resampling supports at most 8000000 target points Hex integration needs a nondegenerate consistently signed Jacobian; repair the cell Integration needs nondegenerate finite cells; repair the geometry Linked probe plot needs a present point array and a valid component Linked probe plot needs at least one valid sample Linked probe plot is disposed; create another Choose a valid profile sample index Probe pipeline operation must be probe, line, integrate, image or resample Progressive rendering needs positive finite budget, scales in (0,1], ordered minima and integer frame counts; correct the options Frame latency must be finite and positive; supply milliseconds An engine already has progressive rendering; dispose its controller first Progressive rendering is disposed; create a new controller maxBytes must be a positive safe integer Expected a PNG signature; supply a PNG file Truncated PNG chunk; supply the complete file Invalid PNG chunk length; supply a valid PNG PNG CRC mismatch; supply an intact PNG Invalid PNG chunk order; supply a valid PNG Invalid PNG end; supply a complete PNG PNG is missing IEND; supply the complete file PNG exceeds maxBytes; raise the explicit bound Provenance exceeds maxBytes; reduce data or raise the explicit bound Provenance exceeds maxBytes; reduce the spec or raise the bound Duplicate PNG provenance; supply an unambiguous export Invalid PNG provenance text; supply a valid iTXt chunk Provenance exceeds maxBytes; raise the explicit bound Expected valid SVG XML; supply an SVG document Duplicate SVG provenance; supply an unambiguous export Trace history exceeded its recording bound; increase maxCalls/maxTraceBytes or start a new recording Recording bounds must be positive safe integers; correct maxCalls/maxTraceBytes Expected provenance version 1; supply the original record Provenance hash mismatch; use the original exported record Trace needs an active provenance figure; call withProvenance before plotting Query needs one unique key per table row Query keys must belong to the shared selection Query is disposed A query predicate must be scalar Spreadsheet needs unique columns Spreadsheet dimensions must be positive, overscan a nonnegative integer Reader workers need owned ArrayBuffers, not shared memory Callback results must be data Open exactly one named reader per session Reader method has expired; open a new session Scientific image output exceeds maxBytes; raise the bound for a trusted file Scientific grid sample count differs from dimensions Scientific grid needs an axis-aligned uniformly spaced world transform; resample the image into physical axes before rendering Supply aligned series arrays with at most 4294967295 total rows Use finite nondecreasing times and finite values or NaN gaps Read an original series row within its length Choose m4, min-max or lttb and an integer pixel width from 1 to 1000000 Use finite ordered domain endpoints under transformX Bind a time series to a 2D figure Create a new series binding after disposal Wait for the current series load before starting another Use numeric series columns; convert integer timestamps explicitly before binding Keep series reads within the source byte bounds Use a safe source size and positive integer chunkBytes Use 2..16777216 finite samples, a positive sample rate and hann or rectangular window Remove gaps before computing a spectrum Use a window within the recording, a positive integer hop and a finite start time and byte limit Increase spectrogram maxBytes or reduce the window count Compute at least one spectrogram window before drawing Embed requires an exact HTTP(S) origin without a path Embed selection needs region and points Embed selection needs valid layer indices and uint32 point indices Embed selection needs a scatter or line layer Embed queue is full; await each request setCamera needs a complete camera setTime needs a time index Unknown embed method connectEmbed needs the iframe contentWindow Embed client disposed Embed timeout must be positive Embed client queue is full Embed request timed out; check origin and viewer readiness Share exceeds maxBytes; use less data or an explicit larger limit Share view must be an object Share timeIndex must identify an existing time step Reserved share key; supply an ordinary figure spec Invalid shared array table; use the original link Invalid shared array reference; use the original link Share exceeds maxBytes Share URL exceeds maxURLLength; use external pinned data or standalone HTML Expected a versioned Margo share fragment Share URL exceeds maxURLLength Unsupported share version; use version 1 Spec hash mismatch; supply the original spec Array hash mismatch; supply the original array Reserved share data key Supply the bundled standalone runtime Standalone backend must be auto, webgpu or webgl2 Deep link belongs to a different standalone figure Invalid figure base64; supply canonical binary data Figure data exceeds maxBytes; use a smaller dataset or raise the explicit limit maxBytes must be a positive integer; supply a bounded allocation limit Figure exceeds maxBytes; reduce data or raise the explicit limit Unsupported figure dtype; use a numeric TypedArray Invalid binary source; supply a SHA-256 and nonnegative element count Unsupported data URL; use HTTP, data or blob Data length differs from spec; provide the pinned source Data hash or length mismatch; provide the pinned source Misaligned binary data; correct the dtype and byte length Figure contains a callback; replace it with declarative data or register a codec Pinned array changed; save it inline or reload the pinned data Invalid saved date; supply a finite UTC date Brick snapshot exceeds maxBytes or has invalid dimensions; use a bounded source Brick source returned a different size; correct its read implementation Figure data is cyclic; use acyclic data or layer references Figure data contains a live object; register a portable layer codec Reserved figure data key; rename the field Figure is too deeply nested; flatten the data Invalid JSON number; use tagged binary values Invalid spec value; load finite JSON Invalid tagged number; use a standard nonfinite token Unknown figure reference; put the dependency before its consumer Missing binary figure attachment; supply the named buffers with the spec Inline data hash mismatch; restore the original bytes Invalid saved date; supply ISO UTC text Invalid component transfer; supply 256 RGBA values and an increasing range Invalid colormap table; supply 256 RGBA samples Unknown or unsafe spec tag; use the versioned schema Recorded figure disposed; create a new one Custom recipe needs a unique kind; use a namespaced identifier Selection needs indices within this figure layers; correct the point references Figure was not recorded; create it with the spec entry or call Figure.record before plotting Unrecorded optional layer; create it with figure.recipe and a portable codec Invalid spec SHA-256; supply the pinned version 1 JSON Invalid figure version or structure; use the version 1 schema Invalid camera vector; supply three finite components Invalid camera projection; correct fov and clip distances Invalid dragMode; use orbit, pan, box or lasso Invalid figure resource; supply unique IDs and ordered updates Unknown layer mutation; use a supported declarative update Invalid layer order; reference each resource once Invalid timeline; supply one frame per finite time Slice needs an earlier volume; correct the resource order Recipe arguments must be an array; correct the saved recipe Mutation is not supported by this layer; correct the recipe Resource order differs from layer order; save layers in creation order Invalid annotation state; supply version 1 records Recording must begin before plotting; use the spec Figure factory Spec hash mismatch; restore the original JSON or create a new spec Set maxBytes to a positive safe integer Consume the live source faster or raise capacity; no messages were silently dropped Set WebSocket capacity to a positive safe integer Raise maxBytes or send smaller WebSocket messages WebSocket connection failed; check the endpoint and connection Raise maxBytes or send shorter SSE fields Raise maxBytes or send smaller server-sent events Serve SSE with Content-Type text/event-stream Set polling interval to milliseconds in [0,2147483647] Raise maxBytes or return a smaller polling response Use live data channels with at most 1000000 samples Align every supplied live-data channel to one length Supply finite live observations, filtering missing values first Supply x and y for append, or at least one channel for patch Choose an unbound native line/scatter in this figure and a rollover of 2..1000000 for lines or 1..1000000 for scatter Match initial live data to the existing layer sample count Use per-point sizes only with a scatter layer Bind a new live layer after disposing this stream Use a nonnegative integer patch index Keep patches inside the current rollover window Bind a new stream after disposing live updates Use finite times and nonnegative elapsed/smoothing values Use a 2D linear/date x axis, positive duration and nonnegative smoothing Choose a representable finite time window Create a new time window after disposal Use a finite representable time-window end Advance a time window by nonnegative finite milliseconds Surface disposed; read values before disposal Surface is disposed; create a new layer before export Aggregation axes need numeric columns, positive bin counts and increasing finite ranges Aggregation supports at most 4096 bins per call Aggregate values must be numeric Aggregate value exceeds float32; rescale the value column Aggregate sum exceeds float32 per tile; rescale the value column Aggregate binding is disposed Table reader limits must be nonnegative safe integers Table exceeds maxBytes or maxRows; project or partition the source CSV delimiter must be one non-quote, non-newline character A table supports at most 4294967295 rows Table columns need names and equal typed lengths Table validity needs one bit per row Categorical columns need unique labels and Uint32 indices Category index exceeds its dictionary Table row is out of bounds Table subset row is out of bounds CrossFilter is disposed Table dimension is disposed Range filters require a numeric column Range needs ordered finite endpoints Tetrahedral volume needs finite xyz, VTK type 10 cells, four distinct valid node indices per cell and end offsets 4,8,... Tetrahedral volume needs one finite scalar or NaN mask per associated point/cell Tetrahedral volume needs at least one finite scalar Tetrahedral classifier range must be finite and increasing Tetrahedral volume must span three physical axes Tetrahedral cells need four distinct node IDs Tetrahedral cells must have nonzero well-conditioned volume Tetrahedral volume has a nonmanifold face shared by more than two cells Adjacent tetrahedral cells must lie on opposite sides of their shared face Tetrahedral association must be point or cell Tetrahedral referenceStep must be finite and positive Tetrahedral cells exceed this GPU texture capacity; partition the mesh Tetrahedral quality and density must be finite and positive Theme fontFamily needs a CSS family list without declarations; supply a font family Theme tickCount must be 2..100; correct the token Theme tickSize must be in [0,64] CSS pixels; correct the token Theme gridStyle must be solid or none; correct the token Theme palette needs nonempty #rrggbb colours; correct the palette Choose a named theme or a complete Theme object Choose nature/ieee and one or two columns Use positive finite heightMM and dpi <= 1000000 Theme series index must be a nonnegative safe integer Choose categorical or scalar theme defaults; keep scalar colour data explicit Theme handle disposed; apply a new theme Histogram counts must match its bins; regenerate the histogram Transfer needs an increasing finite range and positive gradientMax; correct the domain Transfer points need increasing values and four colour channels in [0,1]; correct the points Transfer widget has invalid geometry or RGBA; use a nondegenerate widget in value/gradient units Evaluation needs a finite scalar and nonnegative gradient; correct the sample Transfer table needs an increasing finite range; correct the domain Transfer resolution must be an integer 2..2048; choose a supported resolution Preintegration needs a 1D function, 8..2048 samples, positive step/density and an increasing finite range; correct the options Histogram needs 2..64000000 samples, matching dims and an increasing range; correct the grid Histogram bounds need three nonzero finite extents; correct the physical bounds Histogram gradientMax must be positive; use the observed maximum Unknown transfer preset; choose ct-lung, ct-bone, ct-soft, mri or pet Isosurface has no committed GPU data; await its update before export Link at least two distinct figures of the same dimensionality Choose distinct linked axes x, y or z Camera links disposed; create a new link Choose a source figure from this link Linked limits must lie inside every target scale domain Linked volume views need exact CPU samples, dimensions >=2 and finite nonzero physical spans Crosshair needs three finite physical coordinates Choose x, y or z and a finite physical slice position Layout needs a positive view count, columns and height, nonnegative gap and one label per view Comparison needs cells with finite times Volume quad disposed; create another layout Volume quad disposed during slice creation; create another layout Volume quad disposed before slice publication; create another layout Volume quality needs blockSize 2..32, refinement 4..24, tolerance (0,1], maxStep [1,16] Isovalue must be finite and inside the volume classifier range Isosurface colour needs three linear RGB channels in [0,1] Quality volume is disposed Volume density and quality must be finite and positive Increase blockSize to fit this GPU block texture limit Quality volume needs an invertible transform Volume disposed; read values before disposal Volume is disposed; create a new volume before editing classification Classification needs 2..2048 texels per axis and four bytes per texel; resize the table Classification needs a positive gradientMax, step and density; correct the table metadata Reader callback has expired; open a new session Unexpected nested callback Reader session disposed; open a new session

Cause. A figure or layer got something it cannot draw: data of the wrong size for its grid (surface nx and ny, volume dims), a range that is not finite or has min >= max, an unknown colour map or theme, a GpuArray that is not contiguous f32 or lives on another device, a GpuArray without the range option (its min and max are not read back for you), or an engine without WebGPU.

Fix. Read the message: it names the fix. Pass grid sizes that match the data, ranges as [min, max] with min < max, colour map names from colormapNames (or your own stops), GpuArrays made with createCompute({ engine: figure.engine }) and converted with astype('f32').eval(), and a range read with array.min().item() and array.max().item().

@margoengine/mcp: the AI tools server

timeoutMs must be 100 to 300000 Live host closed; create another host Live command queue is full; wait for the page to answer Live bridge requires enabled: true in a development build errorLimit must be 1 to 1000 The dev relay needs an http endpoint and token Create a fresh live bridge before attaching Attach the live bridge to an engine first Configure addAsset with the app asset loader first Canvas capture needs an HTML canvas Canvas encoding failed; check origin-clean textures Canvas PNG exceeds 12 MB; reduce canvas resolution Unknown object id; call live_scene first Pass a property key from live_properties Unknown live operation; use a listed tool search needs a non-empty query string limit must be a finite number (1 to 25) check_snippet needs a non-empty code string The snippet is over 200000 characters; check one file at a time language is ts, tsx or js kind is all, readme, api, doc or example part is readme, api or both strict must be true or false The type check took longer than the time limit; check a shorter snippet or raise timeoutMs The server was disposed parsePortingGuide takes the matrix and guide markdown as strings The matrix has no table with the columns Status, Margo, Shows it and Notes lookupPorting needs a name or a task createPortingTool needs at least one guide name is required and must be a non-empty string from must be a string limit must be an integer limit must be from 1 to 25 lookupError needs an error code, message or link createErrorTool needs at least one entry error is required and must be a non-empty string limit must be from 1 to 10 render_snippet needs a non-empty code string width and height are integers from 16 to 2048 timeoutMs is from 1000 to 300000 language is ts or js gpuFlags is an array of strings TypeScript snippets need Node 22.13 or newer; pass language js or update Node createDocResources needs a corpus with packages and docs pageSize must be an integer of at least 1 Pass an HTTP asset URL served by the app Asset kind must be model, hdri or texture Name an app material registered with AssetInstaller.materials Pass a supported Material map slot Pass a catalogue asset id, without paths Asset dependency has an unsafe path; choose another asset Asset dependency has a malformed URI; choose another asset Asset path escapes its download directory Catalogue URL is outside the provider allow list; use an official asset maxBytes and timeoutMs must be positive safe integers Asset redirect has no location; choose another asset Asset exceeds maxBytes; select a smaller variant Empty asset response; choose another variant Too many asset redirects; select another variant Use a query up to 500 characters and a listed provider/kind limit must be 1 to 25 and offset nonnegative Unknown asset reference; call search_assets first Unknown variant; call asset_files first Downloaded/unpacked asset exceeds maxBytes; select a smaller variant Asset size differs from metadata; refresh the catalogue Asset checksum differs from metadata; refresh the catalogue Unpacked asset exceeds maxBytes; select a smaller variant Download the asset and configure publicUrl and live before wiring it Supply an endpoint path, allowedHosts and an authorize function HTTP limits must be positive safe integers HTTP transport closed; start a new listener Request exceeds maxBodyBytes HTTP client disconnected; issue a new request Initialize response exceeds maxResponseBytes Remote HTTP requires authorize and exact allowedHosts; mount on HTTPS for remote clients Local bearer token must contain at least 32 characters

Cause. A tool call got an argument it cannot use (a missing or empty string, a value outside the allowed list, a package or entry that does not exist), TypeScript is not installed in the project that check_snippet reads, the compiler did not run or ran out of time, the porting guides file (dist/porting.json) is missing from the install, createDocResources was given something other than a corpus, createMcpServer a pageSize below 1, or the server was disposed while a request was running. The server reports a tool failure as a result with isError set and the error code, so the model can read it and retry.

Fix. Read the message: it names the fix. Pass the arguments the tool lists (call tools/list), use list_packages for package names, and start the server with --root <folder> where the folder has typescript and the @margoengine packages in node_modules (npm install typescript margoengine). Branch on error.code: argument and range are for the caller to fix, unsupported means install TypeScript, failed means retry with a shorter snippet (or reinstall @margoengine/mcp when the porting guides cannot be read). port_to_margo takes a class name or a task in name, and from only as one of the libraries its schema lists.

@margoengine/labels: label layouts and options

priority must be a number place(label, anchor) takes two finite numbers padding must be a finite number of CSS pixels, 0 or more cell must be a finite number of CSS pixels, 1 or more positions must be [x, y] anchors of two finite numbers screenOffset must be two finite numbers width must be a finite number of CSS pixels, 0 or more dot must be a finite number of CSS pixels, 0 or more minLength must be a finite number of CSS pixels, 0 or more

Cause. A label or a label layout got a value it cannot use: a priority that is not a number, an anchor that is not two finite numbers, a Declutter padding, cell or position list out of range, a screenOffset that is not two finite numbers, or a Callouts width, dot or minLength below 0.

Fix. Pass priority as a number (higher is kept first; Infinity is allowed), anchors as [x, y] fractions of the element such as [0, 1], Declutter options such as {padding: 4, positions: eightPositions}, screenOffset as CSS pixels such as [60, -40], and Callouts options such as {width: 1, dot: 2, minLength: 2}.

@margoengine/ui: widgets, layout, themes and input

World panel framebuffer is incomplete; lower its pixelRatio Form options need labels and unique string values Select value must name an option or be empty RadioGroup value must name an option Choice value must name an option HSV channels must be in [0,1] ImageTexture needs positive integer dimensions and width * height * 4 RGBA bytes ImageTexture.from needs a decoded image or a video with a current frame Image needs an ImageTexture; load or create one first Image fit must be contain, cover or fill Image source must be an integer pixel rectangle inside its texture Image borderScale must be finite and nonnegative and tint must contain four values in [0,1] Image slice borders must be nonnegative and fit within the source rectangle Could not decode the UI image; use a supported, CORS-accessible image URL in a browser TextInput value, placeholder and autocomplete must be strings TextInput type is 'text' or 'password' maxLength is -1 or a non-negative integer TextInput value must be a string Selection offsets must be finite Invalid selection direction insertText needs a string Label text is a string List items are an array of strings or { label } entries A list entry is a string or has a string label Inventory columns must be an integer of at least 1 Inventory slots must be an integer from 0 to 4096 A colour is a #rrggbb string or [r, g, b, a] Colour channels must be numbers from 0 to 1 Button text and icon are strings Slider needs finite min < max DrawList popClip has no open clip; pass each pushClip one popClip Slider step must be 0 or more Slider value must be a finite number Edges are a number, [vertical, horizontal] or [top, right, bottom, left] Edges must be finite numbers within 1e6 UI units columns must be an integer of at least 1 gap is a number of at least 0 or [column gap, row gap] offset is [x, y] in finite UI units ProgressBar max must be a number above 0 ProgressBar value must be a finite number UiRenderer needs a Ui: new UiRenderer(new Ui()) Invalid UiRenderer options Atlas sizes and page limits must be positive integers Atlas pages must be at least 64 texels scale must be a number above 0 scale.reference is [width, height] above 0 scale.match is between 0 and 1 theme must come from createTheme() or themes measurer needs advance(), kerning() and metrics() Ui width and height must be numbers from 0 to 65536 pixelRatio must be a number above 0 and up to 16 textScale must be a number from 0.5 to 3 Ui is disposed; create a new Ui dt must be a finite number of seconds, 0 or more toast(message) takes a non-empty string A widget id is a non-empty string pointerEvents is 'auto' or 'none' Expected a Widget; create one with new Panel() and similar A widget cannot contain itself or its ancestor index must be an integer on(type, handler) takes an event name and a function useUi must be used inside <UiRoot>; wrap the interface in <UiRoot engine={engine}> A widget must be inside <UiRoot>; wrap the interface in <UiRoot engine={engine}> announce(message) takes a non-empty string bindInput takes an Input from @margoengine/input made with uiActions() WorldPanel needs a Ui: new WorldPanel(new Ui()) WorldPanel width, height and pixelRatio must be finite and above 0; pass numbers such as { width: 1.2, pixelRatio: 2 } WorldPanel position must be finite and rotation a unit quaternion [x, y, z, w]; normalize the rotation WorldPanels needs a non-empty name and a finite order; pass a name string and an order number WorldPanels.add takes WorldPanel objects; wrap the Ui first: new WorldPanel(ui) wrap is true or false ligatures must be true or false direction must be 'auto', 'ltr' or 'rtl' row is a function from an index to a label or a { label } entry rowHeight must be a number above 0 overscan must be a whole number, 0 or more count must be a whole number, 0 or more row(index) returns a string or a { label } entry parseMarkup takes the markup text parseStyleSheet takes the style sheet text styles is style sheet text or an array of them Use cylinder or sphere, positive radius, 4..512 segments and arc sizes below a full wrap Use a plane, cylinder or sphere, positive integer columns, positive spacing/radius and finite position Panel arrangement wraps onto itself; increase radius or reduce spacing historyLimit must be a positive integer; use 100 Layout needs markup and styles strings; supply both source fields Attribute name must be an XML name; use width, padding or another widget property Move needs existing ids and a non-negative index; select valid elements Cannot move an element into its descendant; select another parent Layout project is not JSON; open a saved layout project Unsupported layout project version; open a version 1 project Locale must be a BCP 47 language tag such as en-US or ar; supply a valid tag missing must be key or error; select a missing-key policy Locale direction must be ltr or rtl; supply one of these values Locale table must map string keys to messages; pass an object Plural messages need string forms and an other fallback; supply a valid message table VirtualKeyboard needs positive keyWidth and non-empty rows; supply at least one key Keyboard keys need non-empty text and positive width; supply a key string Connect a TextInput or null to the keyboard

Cause. A widget, layout style, theme, colour or Ui option got a value it cannot use: a size that is not a number, auto, fill or a percentage; spacing that is not one, two or four numbers; a colour that is not #rrggbb or #rrggbbaa; a theme field or colour role that does not exist; a slider or progress bar with a range that is empty or not finite; a list entry without a label; an index outside the widgets there are; a text scale outside 0.5 to 3; or a Ui used after it was disposed.

Fix. Read the message: it names the fix. Pass sizes as numbers of UI units, "auto", "fill" or "50%", colours as hex strings, themes made with createTheme(overrides, themes.dark), and widgets made with the classes of @margoengine/ui. After ui.dispose() make a new Ui. Branch on error.code, not on the message.

compatibility-layer: the WebGL2 compatibility layer cannot do this (@margoengine/webgl2-compat)

Cause. A MargoError with code unsupported from the WebGL2 compatibility layer: a shader or a call needs something the layer does not map onto WebGL2, and the message names it: something WebGL2 cannot do at all (subgroups, cube array textures, vertex strides above 255 bytes, render shaders that write storage buffers or textures), or something the CPU tier of compute cannot run (multisampled or external textures, or a cube texture in a built-in other than textureSampleLevel, textureDimensions and textureNumLevels, read by a kernel with atomics, workgroup memory or barriers; a page whose Content-Security-Policy forbids JavaScript compiled at run time). install() throws the same code when the browser has no WebGL2 at the full tier, naming what is missing. Features without a supported compatibility route refuse the layer with the same code and a help link. The optional path-tracer fragment route can need long shader compiles; XR uses the separate /xr entry with XRWebGLLayer. The margoengine.com demos, which load the layer only when WebGPU is missing, show such a refusal over the scene with its code instead of a blank view (docs/webgl2-compat-demos.md). A GPUInternalError with code failed that names the work budget is a CPU-tier dispatch that ran past cpuWorkBudget invocations and loop iterations (default 100,000,000): an endless loop, or more work than the CPU can do in one dispatch; nothing it stored lands. Code failed with "a bug: report it" is an internal fault of the layer.

Fix. On a browser with WebGPU, do not install the layer (install() leaves WebGPU alone unless force is set). Without WebGPU, keep the feature off on compatibility devices (isCompatDevice(engine.gpu) from @margoengine/webgl2-compat/device), or use the @margoengine/webgl2-compat/preview preview below the full tier. For the work budget, make the dispatch smaller or raise cpuWorkBudget in install() or on the device. Report any other failed error with the shader that caused it.

wgsl-syntax: the text is not WGSL (@margoengine/webgl2-compat/wgsl)

Cause. parseWGSL or checkWGSL met text that the WGSL grammar does not allow: a character WGSL has no token for, a malformed number (a leading zero, a wrong suffix), a reserved word or a name starting with two underscores, a missing semicolon or bracket, an unclosed block comment, a directive after a declaration, or operators the grammar does not let you mix without parentheses (a & b | c, a < b < c).

Fix. The error names the line and column of the token at fault, in code points, and says what it expected there. Fix the text at that position; error.detail is the message without the position, for an editor that marks it itself.

wgsl-type: the text parses but breaks a WGSL rule

Cause. The WGSL parses, but a rule of the specification fails: an unknown name, a value of the wrong type, a wrong number of arguments, a constant expression that overflows or divides by zero, a missing return, a break outside a loop, a resource without @group and @binding, two resources at one binding in the same entry point, or a fragment-only built-in reached from a compute entry point.

Fix. Read the message at the line and column it names: it states the rule and the fix. The same shader fails in a browser's own WebGPU compiler too, usually with a similar message.

wgsl-limit: the source is past a front-end limit

Cause. The source is longer than 4 MiB, nests brackets, blocks or expressions more than 255 levels deep (expressions 512 levels in the checker), builds a constant with more than 65,536 values, or uses an abstract integer beyond 2^53. The limits are in WGSL_LIMITS; they keep broken or hostile input from hanging the page.

Fix. Split the module, flatten the nesting, use a var instead of a huge constant, or give a large integer a concrete type such as i32 or u32.

@margoengine/procedural: mesh generators

Invalid mesh detail; pass 0, 1 or 2. Invalid seed; pass an integer. Invalid jetty length; pass a number from 4 to 120. Invalid jetty width; pass a number from 1 to 8. Invalid jetty height; pass a number from 0.3 to 4. Invalid boat length; pass a number from 1.5 to 12. Invalid boat seats; pass an integer from 0 to 4.

Cause. A mesh generator option has the wrong type (TypeError) or is outside its range (RangeError), for example a jetty length of 3 m, a boat with 5 seats, a seed that is not an integer or a detail level other than 0, 1 or 2. The message names the option and the range.

Fix. Pass a number inside the range the message gives, true or false for ladder and oars, an integer for seed and seats, and 0, 1 or 2 for detail. Every option is optional: leave it out to get the default.

@margoengine/biomes: biome worlds, climate fields and editing

Biome cells are exact only within 137,000 km disturbance height must be an Int32Array of nx x nz millimetre values disturbance hydrology directions must drain without cycles; rerun hydrology on this grid disturbance hydrology directions must stay inside the grid; rerun hydrology on this grid disturbance fire wind direction must be finite degrees disturbance fire ignitions must be an array of cell indices disturbance hydrology must match this grid; rerun hydrology on it disturbance hydrology must have D8 directions, positive flow and non-negative HAND and water; rerun hydrology() disturbanceTile world bounds must contain four finite metre coordinates disturbanceTile needs positive finite tileSize and resolution in metres disturbanceTile resolution must divide tileSize exactly disturbanceTile needs tile indices inside the world disturbanceTile needs disturbanceOf this world region disturbance needs nx x nz age u16, flood u16 and stage u8 values; pass a disturbance() result decodeDisturbance needs a Uint8Array from encodeDisturbance decodeDisturbance needs a complete MGDS version 1 record from encodeDisturbance Supply a classifier and classification grid Classification needs at least a 3 by 3 integer grid; split oversized rectangles Classification origins and endpoints must fit i32; use a smaller rectangle or origin Supply an integer seed and a positive safe integer cell size in mm Supply a nonnegative integer ecotone half width in cells Supply a built classifier with input modes and 1 to 255 biomes Supply matching flattened envelope arrays from classifier() Envelope starts must cover the dimensions in biome order; rebuild the classifier Envelope bounds must fit i32 and widths must be 1 to 2147483647; rebuild the classifier Classification planes exceed device limits; split the rectangle Supply classification modes from 0 through 6 Supply each source with n * depth cells, or undefined Classification sources must be integers within +/-1073741824; quantize or rescale the source Classification left cells unwritten; check shader dispatch dimensions Supply Uint8Array ids and weights with four slots per inner cell Warp dimensions must be positive safe integers within u32 plane addressing; split the rectangle Warp origins and endpoints must fit signed i32 cell coordinates; use a smaller rectangle or origin Warp lattice geometry does not cover this rectangle; rebuild it with warpLattice Warp lattices must be Int32Arrays of span * rows samples; rebuild them with warpLattice Ecotone warp rectangle exceeds device limits; split it into smaller rectangles Warp corner exceeds the safe i32 temperature bound; use corners within +/-13389004 Ecotone warp dispatch left cells unwritten; check the shader dispatch dimensions GPU hydrology needs Int32Array heights GPU hydrology needs integer nx,nz >= 2, matching heights, n <= 2147483647 and step >= 1 GPU hydrology options must be an object GPU hydrology needs finite sea, positive lakeDepth, channelCells >= 1 and boolean multiple GPU flow did not converge within the cell count; check drainage for cycles GPU work needs 1..2147483647 invocations and valid device limits GPU work exceeds dispatch limits; use a smaller input GPU work needs 64 compute invocations per workgroup GPU storage exceeds device limits; use a smaller input GPU left invocations unwritten; check shader dispatch dimensions GPU placement needs a live BiomePlacement from this module GPU placement needs nonnegative i32 plan values; reduce cluster/stand scale or density GPU Poisson count is invalid; check shader execution GPU candidate prefix exceeds i32; use a smaller placement window GPU placement dependency window is incomplete; check the cone derivation GPU placement candidate is missing; check emission Region axes require 2..32768 corner samples; split larger regions Region spacing and rectangle sizes must be positive safe integers Region rectangle or cell size is too large; use a smaller rectangle or cell Region origins and endpoints must be safe integer cell coordinates Packed region grids exceed u32 addressing; split the region Region rectangle exceeds device limits; split it into smaller rectangles Region dispatch left cells unwritten; check the shader dispatch dimensions GPU placement needs tile indices inside the world World changed during GPU placement; request the tile again BiomeObjects.attach takes an engine and a BiomePlacement BiomeObjects bounds must be [minX, minZ, maxX, maxZ] with max above min BiomeObjects detail maps exceed detailBudget or the device's largest texture; raise detailResolution or detailBudget, or shrink bounds BiomeObjects needs a heightmap function and the bounds [minX, minZ, maxX, maxZ] it covers A reverse-j size needs q in 1..10 (above 1) and max in 0.5..8 A weibull size needs shape in 0.5..10 and scale in 0..4 (above 0) A size distribution kind is 'reverse-j' or 'weibull' A cluster needs kind 'thomas', 'matern' or '2dt', parents 0..10,000 per ha and spread 0..500 m A cluster needs offspring above 0 and a 2dt tail in 0.5..8 A species stands rule needs scale 50..2000 metres and cover 0.1..1 canopyCover step must be a positive multiple of the world resolution BiomeObjects far radius must reach past the stored objects' radius BiomeObjects far count must be from 1 to 1,000,000 BiomeView canopy must be a number from 0 to 1 (default 0.6 with objects, 0 without) BiomePlacement rounds must be an integer in 1..16 A world can place at most 255 species BiomePlacement conflicts is an object of factors A conflict is 'idA|idB' with a factor in 0..4 An exclusion needs points: [x, z] pairs in metres An exclusion verge must be 0 or more metres A line exclusion needs a width above 0 metres A polygon exclusion needs 3 or more points An exclusion kind is 'line' or 'polygon' BiomePlacement.attach takes a BiomeWorld BiomePlacement options must be an object; pass {} for the defaults BiomePlacement is disposed; attach a new one with BiomePlacement.attach(world) BiomePlacement update takes { exclusions?, conflicts?, graph? } BiomePlacement onChange takes a function BiomePlacement inspect takes a [minX, minZ, maxX, maxZ] rectangle in metres BiomePlacement tile ahead is a list of [x, z] tile indices BiomeWorld tilePart window is [i0, j0, i1, j1] in tile cells with 0 <= i0 < i1 <= cells and 0 <= j0 < j1 <= cells A pattern is { x, z, window: [minX, minZ, maxX, maxZ] } with x and z of equal length Statistic radii must be 0 or more pairCorrelation bandwidth must be above 0 globalEnvelope needs 19 or more simulated curves as long as the observed one globalEnvelope alpha must be in 0..1 globalEnvelope type is 'mad' or 'rank' ksTest needs 8 or more samples andersonDarling needs 8 or more samples quantileFit needs 3 or more (x, y) pairs quantileFit tau must be in 0..1 A BiomeEditor stroke is already open; end it before starting another A biome edit is an object such as editor.edits holds A biome edit kind is 'paint', 'fill' or 'path' A path edit needs the splines entry; await import('@margoengine/biomes/splines') first A carved height needs the splines entry; await import('@margoengine/biomes/splines') first (BiomeWorld.create loads it) A path is an object such as { points: [[0, 0], [40, 10]], width: 4 } A path needs 2 to 65,536 points: [x, z] pairs in metres within 1,100 km of the origin A path curve is 'polyline', 'catmull-rom' or 'b-spline' A path closed option is true or false A path step is the spacing of curve samples in metres, 0.25..64 A path width is a number of metres, 0.1..2,000 A path edge is a number of metres, 0..1,000 A path falloff is 'smooth', 'linear' or 'constant' A path strength is a number 0..1 A path biome is a biome id such as road (lowercase letters, digits and dashes) A path mask is a name such as roads (letters, digits, _ and -), or mask/roads A path carve is { mode: 'flatten' or 'cut', depth: 0..100 m, grade: 0..2,000 m } A path samples to over 262,144 points; use fewer points, a larger step or a polyline A carved height takes { carve: [paths], base?: height source } layoutSettlements needs a world with bounds [x0, z0, x1, z1] and heightAt(x, z), such as a BiomeWorld layoutSettlements needs finite world bounds with x1 > x0 and z1 > z0 layoutSettlements options must be an object A settlement spacing must be a number of metres, 50..100,000 (and likewise each setting names its range) A settlement road is path settings without points (the layout finds them) A settlement grid of 4097 x 4097 cells is over 4,194,304; pass a larger cell A placement graph is { nodes: [...], outputs: { selector: node id } } A placement graph has 1 to 256 nodes A placement graph node has an id of letters, digits, _ and - (1 to 64) A placement graph op is constant, range, noise, multiply, min, max, add, subtract, invert, curve or blend A placement graph has a cycle A placement graph constant is 0..1 A placement graph range is [min, max] with null for an open side A placement graph range blend is above 0 and at most 1 A placement graph noise scale is a whole number of metres, 1..100,000 A placement graph noise seed is an integer A placement graph subtract node takes 2 inputs A placement graph curve has 2 to 16 points [x, y] in 0..1, x increasing A placement graph blend node takes 2 inputs and by A placement graph has outputs: { selector: node id } An ecosystem species has an id and a radius An ecosystem species radius is 0.1..40 (and likewise each setting names its range) growEcosystem takes { bounds, species, plants?, years, ... } Ecosystem bounds are [x0, z0, x1, z1] in metres within 100 km of 0, with x1 > x0 and z1 > z0 An ecosystem has one or more species Two ecosystem species share an id Ecosystem years is a whole number, 0..2000 An ecosystem seed is an integer An ecosystem where is a function (x, z, species) => 0..1 An ecosystem plant is { species, x, z, radius?, age? } An ecosystem plant names a species of the ecosystem An ecosystem plant has an x and z within 100 km of 0 carvePaths takes an array of paths and an optional height source pathExclusions takes an array of paths pathEdits takes an array of paths paintPaths takes a BiomeEditor and an array of paths A biome edit layer is a biome id, paint/<biome> or mask/<name> A biome envelope blend must be in 0..1 (above 0) A relief height needs the relief entry; pass it to BiomeWorld.create or await import('@margoengine/biomes/relief') first A biome envelope range is [min, max] with min <= max (null leaves a side open) A biome id must be a string of a-z, 0-9 and -, such as "temperate" A biome needs 1 to 4 ground layers A biome needs a climate envelope object A biome priority must be a finite number A biome weight is a number from 0.1 to 10 (1 leaves the classification as it is) A brush mode is add, subtract, set, max or min and a falloff smooth, linear or constant A brush needs a finite [x, z] centre and a radius in 0..65,536 m (above 0) A brush strength is 0..1 A fill mask is mask/<name> A fill rectangle is [minX, minZ, maxX, maxZ] in metres A ground layer needs a string material A ground layer weight must be 0 or more A height field must be a function (x, z) => metres A height field returned a non-finite or huge value; return metres A height source is { samples, width, depth }, { field } or { relief } A layer write changed rectangle is [minX, minZ, maxX, maxZ] in metres A paint layer names a biome of this world, an optional mode and an optional mask A species rule needs a string id and mesh A species rule needs density 0 or more, radius above 0 and shade 0..1 A user layer is paint/<biome id of this world> or mask/<name> A user layer raster is a Uint8Array of cells x cells values Biome details must be an array of detail rules Biome digests need Web Crypto (crypto.subtle); serve the page over https or localhost Biome zones must be an array of class or life-zone names BiomeEditor is disposed; attach a new one BiomeEditor.attach takes a BiomeWorld BiomeView needs a WebGPU engine; create the engine with WebGPU BiomeView disposed BiomeView lookahead must be 0 or more seconds and budget above 0 ms BiomeView prefetch takes a [minX, minZ, maxX, maxZ] rectangle in metres BiomeView radius must be above 0 BiomeView shadows must be a Shadows from @margoengine/shadows BiomeView sky must be a Sky from @margoengine/sky (it reads reflectionTexture and lights) BiomeView textureResolution must be a positive multiple of the world resolution overviewWeights textureResolution must be a positive multiple of the world resolution BiomeView water must be true, false, 'auto' or Water settings BiomeView water rivers must be 'auto', 'hydrology' or river lines; lakes 'auto' or false riverWater needs bounds with x1 > x0 and z1 > z0, and width x depth heights of at least 2 x 2 riverWater lakes need nx x nz levels and a step of at least 1 mm (lakeLevels) River lines must be Int32Arrays of [x, z, ...] millimetres with at least two points BiomeView.attach takes an engine and a BiomeWorld BiomeWorld backend must be 'auto', 'gpu' or 'cpu' BiomeWorld backend 'gpu' requires the device option (a GPUDevice) BiomeWorld backend 'gpu' runs on this thread; pass workers: 0 BiomeWorld backend 'gpu' allows at most 32768 region corners per axis; use a larger regionResolution or smaller size BiomeWorld backend 'gpu' packed region exceeds device buffer limits; use a smaller size or larger regionResolution BiomeWorld backend 'gpu' tile row and margins exceed device limits, where a non-perCell zone scorer needs a full tile; use fewer biomes or classifier inputs, smaller tileSize, larger resolution, or backend 'cpu' BiomeWorld backend 'gpu' heights must be within +/-1073741824 mm; rescale the height source or use backend 'cpu' BiomeWorld GPU device lost; recreate the WebGPU device BiomeWorld cache must be an integer number of tiles, 1..4,096 BiomeWorld ecotone must be a number of metres, 0..128 (0 keeps painted edges hard) BiomeWorld biome ids must be unique BiomeWorld biomes must be 1 to 254 biome definitions hydrology needs height as an Int32Array of millimetres erode needs height as an Int32Array of millimetres Erosion options must be an object; pass {} for the defaults ErosionKernel is disposed; create a new kernel Erosion input allocation failed Erosion kernel rejected validated input Erosion Wasm could not load; serve valid SIMD package assets erode needs nx and nz of 2 or more (at most 2,097,152 cells), nx x nz heights within +-33,554,432 mm and a step of 1..1,048,576 mm Erosion iterations must be an integer from 0 to 1,024 Erosion talus must be an angle of 0 to 89 degrees Erosion sea must be a height in mm Relief erosion step must be 1 to 1,024 metres Relief erosion grid is over 2,097,152 cells; use a larger step Relief erosion must be an object of erosion settings; pass {} for the defaults PNG compress needs CompressionStream; leave compress off for stored blocks encodePng needs a positive integer width and depth encodePng rows are the wrong length for width, depth and depth bits Export tiles is [x0, z0, x1, z1], inclusive tile indices inside the world exportHeight format is 'png16', 'raw16' or 'f32' exportLayer format is 'json' or 'csv' loadWorld takes the JSON text or object that saveWorld(world) returns Not a saved biome world (format margo-biomes-world, version 1) Saved height samples are Int32Array or Float32Array Saved classifier is envelopes, whittaker, holdridge or a multinoise spec saveWorld cannot save a height function A relief with erosion needs the erosion entry; await import('@margoengine/biomes/erosion') first (BiomeWorld.create loads it) A placement with a graph needs the graph entry; await import('@margoengine/biomes/graph') first hydrology needs nx and nz of 2 or more, nx x nz heights and a step of at least 1 mm hydrology channelCells must be 1 or more and lakeDepth above 0 hydrologyTile needs tile indices inside the world BiomeSeasons.attach takes a BiomeWorld and { dayOfYear, weather? } BiomeSeasons dayOfYear must be an integer from 1 to 365 BiomeSeasons weather must be an object such as { snowfall: 1, rain: 0 } BiomeSeasons weather <snowfall or rain> must be a number from 0 to 1 BiomeSeasons set takes { dayOfYear?, weather? } BiomeSeasons onChange takes a function BiomeSeasons reads the temperature, warmest, rainfall and moisture layers; request the tile with them BiomeSeasons is disposed; attach a new one BiomeObjects seasons must be a BiomeSeasons from @margoengine/biomes/seasons BiomeObjects seasons must be a BiomeSeasons attached to the placement's world BiomeView seasons must be a BiomeSeasons attached to the same world BiomeWorld classifier is 'envelopes', whittaker or holdridge from '@margoengine/biomes/zones', or multiNoise(spec) from '@margoengine/biomes/multinoise' multiNoise takes { axes, points, blend? } with arrays of axes and points multiNoise blend is a number from 0 to 1 multiNoise takes 1 to 8 axes { field, range: [min, max], weight? } multiNoise takes 1 to 1,024 points { biome, at } multiNoise axes are { field, range: [min, max], weight? } multiNoise axis range is [min, max] with min below max multiNoise axis weight is an integer from 1 to 16 multiNoise axis range is too narrow for the field resolution multiNoise axis fields must all be different multiNoise points are { biome, at } with a biome id and positions per axis field multiNoise point names a field that is not an axis multiNoise point positions are a number or [min, max] multiNoise point positions must lie inside the axis range multiNoise names a biome the world does not have; add it to BiomeWorld biomes BiomeWorld is disposed; create a new one with BiomeWorld.create() BiomeWorld onChange takes a function BiomeWorld options must be an object; pass {} for the defaults BiomeWorld origin must be [x, z] in metres within 1,000 km BiomeWorld regionResolution must be a power of two from 4 x resolution up to tileSize BiomeWorld resolution must be 0.5, 1, 2 or 4 BiomeWorld sample needs finite x and z BiomeWorld sampleRegion needs finite x and z BiomeWorld heightAt needs finite x and z BiomeWorld seed must be an integer in 0..2^32-1 BiomeWorld size must be [x, z] in metres, 256..65,536, multiples of regionResolution BiomeWorld tile indices must be integers inside the world (0..tilesX - 1, 0..tilesZ - 1) BiomeWorld tileSize must be 128, 256 or 512 BiomeWorld tiles takes a [minX, minZ, maxX, maxZ] rectangle in metres BiomeWorld update called from an onChange listener; update after the listener returns BiomeWorld update takes { biomes?, classifier?, paint?, climate?, height? } BiomeWorld workers must be an integer 0..16 or false BiomeWorld writeLayer called from an onChange listener; write after the listener returns BiomeWorld writeLayers takes an array of layer writes Climate options must be an object; pass {} for the defaults Climate wind must be a non-zero [x, z] direction The biome world is disposed; create a new world Unknown biome worker job; load the page and the worker script from one build The page sent no URL for a biome worker part; load the page and the worker script from one build Height sample unit must be 'm' or 'mm' Height samples must be an Int32Array (mm) or a Float32Array (m) Height samples need width and depth of 2 or more and width x depth values Climate <option> must be a number in <min>..<max> Climate lapseSplit must be at most twice lapseRate Climate poleTemperature must not be above equatorTemperature Climate rainSeason must be 'auto', 'uniform', 'summer' or 'winter' Invalid relief options; size 64..65,536 m, origin within 1,000 km, base within 8 km, relief and seaDepth 0..8,000 m, coast none/west/east/north/south/island and 0..8 rivers Invalid relief islands; use them with coast: 'island', count 1..8 and a radius from 100 m to 0.39 of the shorter side Invalid relief shelf or valley; shelf 1..16,000 m (on islands up to the radius), valley width and mouth 1..4,000 m and a floor from 0 up to below both Relief options must be an object; pass {} for the defaults Unknown biome layer name; use names from LAYERS Unknown envelope field; use a ClimateEnvelope field, a LAYERS name or mask/<name> defineBiome takes a biome definition object groundWeights needs a tile with the biome and biomeWeight layers isqrt needs an integer in 0..2^52; clamp or scale the value first quantizeHeights needs a Float32Array or Float64Array of heights quantizeHeights unit must be a positive number riverSources needs the river lines (world.rivers) and a heightAt(x, z) function riverSources needs discharge 0..100000 m^3/s and a finite radius >= 0 metres BiomeView water flow must be true, false or { discharge, substeps } BiomeView water flow needs discharge 0..100000 m^3/s and substeps an integer 1..64 (default 20 and 8)

Cause. A biome world option, height source, climate setting, tile request or edit was out of range or the wrong shape, or the world was used after dispose() or changed from inside its own onChange listener.

Fix. Check the option against the defaults table in the package README (every option lists its range and default), pass tile indices inside 0..tilesX - 1 and 0..tilesZ - 1, create a new world after dispose(), and call update after an onChange listener returns.

kinematics-constraints: a convex hull or link hull was set up wrongly

ConvexHullVolume points must be flat x, y, z values ConvexHullVolume maxPoints must be a positive integer ConvexHullVolume needs at least one point ConvexHullVolume has more points than maxPoints; pass hull corners only or raise it ConvexHullVolume matrix must have 16 values ConvexHullVolume matrix has a non-finite value; check the bone ConvexHullVolume matrix must be affine; its last row must be 0, 0, 0, 1 A link hull must be a ConvexHullVolume A link hull axis and hinge must be non-zero and not parallel An upper link hull replaces upperArmRadius and rootExclusion; pass one or the other A collider of a solver with link hulls needs a hullClearanceInto method A link hull cannot also be a collider; pass a separate ConvexHullVolume A volume with an overridden segmentClearance must override hullClearanceInto for link hulls

Cause. A ConvexHullVolume got points or a matrix it cannot use, such as a raw mesh over the point limit or a matrix holding NaN from a broken bone. Or an AvoidanceSolver with links got a hull frame or a collider it cannot check against a hull.

Fix. Pass hull corners as flat x, y, z values (convexGeometry makes them from a mesh) and raise maxPoints above 64 only if you need to. Pass a column-major affine matrix of 16 finite values to setTransform. Give each link a separate hull with axis and hinge not parallel. A custom collider in a solver with link hulls implements hullClearanceInto(hull, outDistance).

Voxel path tracer backend and kernel

VoxelPathTracer needs WebGPU or the WebGL2 compatibility layer Emissive sampling kernel does not match this tracer

Cause. The engine has the native WebGL2 backend, or the optional resampling entry and tracing kernel do not match.

Fix. Use the WebGPU backend, or install @margoengine/webgl2-compat before Engine.create. Rebuild @margoengine/voxel-pathtracer as a whole when its optional resampling entry reports a kernel mismatch.

voxel-net: names, snapshots and refused connections

The voxel-net server closed the connection with <code>; check that it is running and that server and client are the same version The voxel-net server sent nothing for <ms> ms (serverTimeout); the network or the server is gone, so join again VoxelServer clientTimeout <ms> must exceed heartbeatInterval <ms>; a client needs time to answer a ping serverTimeout <ms> must be finite and >= 0 milliseconds; 0 never gives up VoxelServer closed during importEdits, so nothing was imported; call importEdits before close VoxelServer filterName must be a function (name, id) => string VoxelServer filterName returned <type>; return the name to show, or '' for none VoxelServer importEdits chunk <key> uses block state <state>, not in the block types; import a snapshot of this game VoxelServer importEdits got <n> chunks over maxEditedChunks (<max>); raise maxEditedChunks or pass a store VoxelServer importEdits key <key> is not a chunk 'cx,cy,cz' inside the world; use exportEdits keys VoxelServer importEdits keys must be strings like "0,-1,2" VoxelServer importEdits must put chunks back to the generator, so the store needs delete(key); add it to your VoxelEditStore VoxelServer importEdits needs a Map; pass what exportEdits returned VoxelServer is closed; call importEdits before close names must be an array of PlayerName names name must be a string

Cause. A client and server of different protocol versions met, or the server refused the page or stopped, or nothing arrived for serverTimeout on a dead network; a filterName hook returned something other than a string; or importEdits got something other than the output of exportEdits for this game.

Fix. Build server and client from the same voxel-net version (PROTOCOL_VERSION), and read the close reason in the message. After a silent server, join again; keep serverTimeout well above the server's heartbeatInterval, and clientTimeout above heartbeatInterval. Return a string from filterName. Pass importEdits the Map that exportEdits returned, on a server with the same block types, and give a VoxelEditStore a delete(key) when chunks must go back to the generator.

@margoengine/scatter: picking and other optional entries

boundsOf takes a Float32Array of positions and a stride of 3 or more InstancePicker takes transforms: a Float32Array of 16 floats per instance A pick mesh is { positions, stride?, indices } with indices into positions InstancePicker needs bounds { min, max } or a mesh { positions, indices } A pick box is { min: [x, y, z], max: [x, y, z] } with min at most max A pick cell is a number of world units above 0 A pick instance index is an integer 0..count - 1 A pick ray needs a finite origin and a direction other than 0 A pick maxDistance is above 0 (default Infinity) A pick centre is a finite [x, y, z] A pick radius is a number above 0 setTransform takes 16 floats of a column-major matrix trampledPoseCode takes a scatter vertex stage Trample options must be an object A trample size is world units above 0 A trample resolution is an integer from 8 to 1024 A trample recover time is seconds above 0 A trample bend is radians above 0, at most pi / 2 setInteractors takes an array of at most 4096 interactors An interactor is { position: [x, y, z], radius, strength? } An interactor position is three finite numbers An interactor radius is world units above 0 An interactor strength is from 0 to 1 imposterRingCode takes @margoengine/lod's imposterShader ImposterScatter takes an Imposter

Cause. An option or argument of a scatter entry is out of its range or of the wrong type: for InstancePicker, transforms that are not 16 floats an instance, a box with its min above its max, a mesh index past its positions, a ray with no direction, or an instance number past count; for TrampledScatter, a trample option out of range or an interactor with no position or radius; for ImposterScatter, no lod Imposter in imposter.

Fix. Pass the transforms instanceTransforms or groundTransforms return, the drawn mesh's local box (or its mesh, and boundsOf makes the box), a ray with a direction other than 0, and instance numbers below picker.count. Give each interactor { position: [x, y, z], radius } with a radius above 0 and a strength from 0 to 1. Bake the far mesh with Imposter.bake(engine, mesh) from @margoengine/lod and pass it as imposter. The package README lists every option with its range.

@margoengine/vfx: numbers that do not fit in f32

VFX nodes const is not a finite f32 VFX nodes const[0] is not a finite f32 VFX nodes const[1] is not a finite f32 VFX nodes const[2] is not a finite f32 VFX nodes scale is not a finite f32 VFX shadows range is not a finite f32 VFX shadows intensity is not a finite f32

Cause. A node literal or a shadow range or intensity was a finite JavaScript number that is infinite once stored as an f32, so the GPU uniform would not be a real value.

Fix. Pass a number that stays finite as an f32, such as a range of 4, an intensity of 1, or a force of [0, 2, 0]. Values that underflow to zero are finite and are kept.

@margoengine/cache: asset caching, loading managers, bundles and prefetch

Bundle manifest needs a bundles object; pass {bundles: {name: {files, deps}}} Bundle load concurrency must be at least 1 Decoded cache needs a SHA-256 sourceHash, nonempty deviceFormat and decoder; set variant for decoder options Decoded results must be acyclic plain records, arrays, finite scalars and binary arrays; remove unsupported values Use a supported numeric typed array for decoded data Use plain records for decoded metadata; class instances cannot be cached Decoded cache metadata is truncated; decode the source again Decoded cache array is truncated; decode the source again Decoded cache array type is unknown; decode the source again Use a defined decoded result; undefined is reserved for cache misses AssetCache maxBytes and timeout must be non-negative LoadingManager fetch is not a function; pass a fetch-compatible function LoadingManager URL modifier is not a function; pass (url) => string or undefined Prefetcher concurrency must be at least 1 and idleTimeout non-negative throttle bytesPerSecond must be positive and burst non-negative RangeCache maxBytes and timeout must be non-negative and block a positive integer

Cause. An option of AssetCache, RangeCache, LoadingManager, Prefetcher, throttle, a bundle manifest or the decoded cache is outside its range or of the wrong type (TypeError, RangeError), or the network answered a bundle, hashed, prefetched or managed file with an HTTP error or bytes that do not match the manifest hash (code failed). Messages with a value in them, such as a URL, a bundle name or an HTTP status, name that value.

Fix. Pass non-negative byte budgets and timeouts, a concurrency of at least 1, functions where a function is asked for, and a bundle manifest whose bundles list every dependency once with the lowercase SHA-256 hex of hashBytes. For a failed load, publish the file and its manifest together and check that the server answers the URL with status 200.

wgsl: errors of the WGSL front end (@margoengine/webgl2-compat/wgsl)

Cause. A shader failed the WGSL front end. Every message ends with its position and a link to one of three entries by code: wgsl-syntax, wgsl-type or wgsl-limit. WGSL_HELP, the base of those links, points here.

Fix. Read the code in the message (or the code of the WGSLError) and open its entry: #wgsl-syntax for text that is not WGSL, #wgsl-type for a broken WGSL rule, #wgsl-limit for a source past a limit.

@margoengine/vfx: saving and loading effect JSON

Cause. A VFX preset cannot be turned into JSON or built from it: its version is not 1, a value cannot be embedded (a function, a class instance or an unsupported typed array), a resource reference has no binding, or the file request returned an error status.

Fix. Save presets with version 1. Pass GPU resources and other live objects by reference: give references when saving and bindings when loading, so the file holds only the reference. Use numeric typed arrays. For a failed request, check the URL and the response status.

@margoengine/points: octree cloud options

Cause. An OctreeCloud option is outside its range. maxConcurrentLoads must be a positive safe integer (the default is 4); pointBudget, minNodePixels and maxLoadedPoints must be above 0.

Fix. Pass a positive whole number for maxConcurrentLoads, or leave it unset for the default.

Back to margoengine.com