manifold::Error::PropertiesWrongLength

Diagnostic signature

PropertiesWrongLength

The Manifold geometry kernel rejects a MeshGL object because its flattened `vertProperties` array length is not evenly divisible by the specified `numProp` stride.

What it means

In the `manifold` toolchain (including its C++, Rust, and JS/WASM bindings), 3D meshes are passed into the kernel using the `MeshGL` (or `MeshGL64`) structure. Vertex properties—such as position, normals, and UV coordinates—are stored in a single, flattened floating-point array named `vertProperties`. The `numProp` field defines the stride of this array, dictating that every vertex must be represented by exactly `numProp` sequential float values (at minimum, 3 values for x, y, z coordinates). If the total length of the `vertProperties` array is not a perfect multiple of `numProp`, the geometry kernel cannot cleanly demarcate the array into individual vertices. Manifold detects this discrepancy during initialization and immediately returns an invalid state tagged with the `PropertiesWrongLength` diagnostic.

Why it happens

This diagnostic is emitted when constructing a `Manifold` geometry object from a `MeshGL` structure where the condition `mesh.vertProperties.size() % mesh.numProp != 0` evaluates to true. It typically occurs during programmatic mesh generation when a routine appends an incomplete set of properties for a vertex. For example, a developer might provide an (x, y) coordinate but forget the z coordinate, or forget to append trailing UV channel data for the final vertex. It can also happen in language bindings (like Rust or WebAssembly) when pre-allocating a buffer using only the vertex count rather than multiplying the vertex count by `numProp`.

Minimal reproduction

#include <manifold/manifold.h>
#include <iostream>

int main() {
    manifold::MeshGL mesh;
    mesh.numProp = 3; // Require at least x, y, z
    
    // Length is 8, which is not a multiple of 3.
    // The 3rd vertex is missing its z-coordinate.
    mesh.vertProperties = {
        0.0f, 0.0f, 0.0f,
        1.0f, 0.0f, 0.0f,
        0.0f, 1.0f
    };
    mesh.triVerts = {0, 1, 2};

    manifold::Manifold m(mesh);
    
    if (m.Status() == manifold::Manifold::Error::PropertiesWrongLength) {
        std::cerr << "Diagnostic triggered: PropertiesWrongLength\n";
    }
    return 0;
}

How to fix it

Ensure the size of the `vertProperties` array is exactly a multiple of `numProp` by checking the geometry generation logic and guaranteeing every vertex submits a complete set of channel floats.

```C++
#include <manifold/manifold.h>
#include <iostream>

int main() {
    manifold::MeshGL mesh;
    mesh.numProp = 3; // Require at least x, y, z
    
    // Length is 9, exactly a multiple of 3.
    // All three vertices have complete components.
    mesh.vertProperties = {
        0.0f, 0.0f, 0.0f,
        1.0f, 0.0f, 0.0f,
        0.0f, 1.0f, 0.0f 
    };
    mesh.triVerts = {0, 1, 2};

    manifold::Manifold m(mesh);
    
    if (m.Status() == manifold::Manifold::Error::NoError) {
        std::cout << "Mesh constructed successfully!\n";
    }
    return 0;
}
```

Step 1

Step 2

Step 3

Upstream references

Manifold: MeshGLP Struct Template Reference

Manifold Class Reference (Error Enum Declarations)