InvalidConstruction
The Manifold geometry kernel sets the InvalidConstruction error status when a primitive constructor or procedural solid builder receives invalid, degenerate, or contradictory parameters that prevent the generation of a valid 2-manifold solid mesh.
In the Manifold 3D geometry library and its WebAssembly bindings (manifold-3d), InvalidConstruction is a value of the Manifold::Error enum (represented as the string 'InvalidConstruction' in the ErrorStatus TypeScript type). It signifies that a solid constructor failed to produce an oriented, closed 2-manifold boundary representation due to invalid input parameters. Instead of throwing an unhandled exception or producing a corrupted mesh structure, Manifold returns an empty solid whose status() accessor reports InvalidConstruction. In accordance with Manifold's error design, this error state persists and propagates through subsequent CSG operations (such as union, difference, and intersection) and geometric transformations, ensuring failed constructions do not fail silently.
The kernel marks a manifold with InvalidConstruction whenever geometric or topological preconditions for solid creation are violated during construction. Common causes include: 1. Constructing primitives (such as Cylinder, Cube, or Sphere) with non-physical, negative, or invalid geometric parameters. 2. Extruding or revolving 2D cross-sections that contain self-intersections, inverted polygons, or invalid contour data that cannot be topologically swept into a closed 3D solid. 3. Invoking multi-object constructors (such as Compose or Hull) with empty input arrays or incompatible topological inputs. 4. Passing out-of-range bounds, invalid step sizes, or non-evaluable signed-distance function specifications to implicit surface constructors like LevelSet. 5. Performing geometric operations on an existing empty Manifold whose status was already set to InvalidConstruction from an earlier failed step.
import Module from 'manifold-3d';
async function main() {
const manifoldModule = await Module();
manifoldModule.setup();
const { Manifold } = manifoldModule;
// Attempt to construct a cylinder with negative height
const invalidMesh = Manifold.cylinder(-10, 5, 5, 16);
const errorStatus = invalidMesh.status();
console.log(`Status: ${errorStatus}`);
if (errorStatus === 'InvalidConstruction') {
console.error('Construction rejected: InvalidConstruction');
}
}
main();
Ensure all constructor inputs strictly obey kernel domain requirements by passing positive dimensions, validating 2D polygon topology prior to sweeping, supplying non-empty arrays to multi-body constructors, and querying status() on intermediate shapes.
```javascript
import Module from 'manifold-3d';
async function main() {
const manifoldModule = await Module();
manifoldModule.setup();
const { Manifold } = manifoldModule;
// Supply valid, positive geometric parameters
const height = 10;
const radiusLow = 5;
const radiusHigh = 5;
const circularSegments = 16;
const validMesh = Manifold.cylinder(height, radiusLow, radiusHigh, circularSegments);
const errorStatus = validMesh.status();
console.log(`Status: ${errorStatus}`); // Outputs: Status: NoError
}
main();
```
manifold-3d manifold-3d 2.5.1 package artifact — Manifold::Error — retrieved 2026-08-11