Trouble with recolor verticies

Hi, I’m trying to recolor glb model to different colors by vertex color.
my collegue writes into model color which i’m read as indifier to find a new color to this vertex

this is my code

  let  type = (1+Math.ceil(Math.random()*3)).toString()
  console.log(colorTypes);
  node.getChildMeshes().forEach((mesh,j)=>{
    const vertexData = VertexData.ExtractFromMesh(mesh);
            if (vertexData.colors) {
                const length = vertexData.colors.length
                for (let i = 3; i < vertexData.colors.length; i += 4) {
                    let key = vertexData.colors[i].toString()+vertexData.colors[i-1].toString()+vertexData.colors[i-2].toString();
                   // console.log(type)
                    let newColors = colorTypes.get(type)!.get(key)
                    //console.log(newColors,key)
                    if(newColors){
                      vertexData.colors[i] = 1//newColors[0]; 
                      vertexData.colors[i - 1] =1 //newColors[1];
                      vertexData.colors[i - 2] = 1//newColors[2];
                    }
                }
                console.log(vertexData.colors.length,length)
                if(vertexData.colors.length==length)
                  vertexData.applyToMesh(mesh as Mesh);
            }
          })

but it failed with this error RangeError: attempting to construct out-of-bounds Float32Array on ArrayBuffer
in this part of engine code

      static GetFloatData(data, size, type, byteOffset, byteStride, normalized, totalVertices, forceCopy) {
        const tightlyPackedByteStride = size * _VertexBuffer.GetTypeByteLength(type);
        const count = totalVertices * size;
        if (type !== _VertexBuffer.FLOAT || byteStride !== tightlyPackedByteStride) {
          const copy = new Float32Array(count);
          _VertexBuffer.ForEach(data, byteOffset, byteStride, size, type, count, normalized, (value, index) => copy[index] = value);
          return copy;
        }
        if (!(data instanceof Array || data instanceof Float32Array) || byteOffset !== 0 || data.length !== count) {
          if (data instanceof Array) {
            const offset = byteOffset / 4;
            return data.slice(offset, offset + count);
          } else if (data instanceof ArrayBuffer) {
            return new Float32Array(data, byteOffset, count);
          } else {
            let offset = data.byteOffset + byteOffset;
            if (forceCopy) {
              const result = new Float32Array(count);
              const source = new Float32Array(data.buffer, offset, count);
              result.set(source);
              return result;
            }
            const remainder = offset % 4;
            if (remainder) {
              offset = Math.max(0, offset - remainder);
            }
            **return new Float32Array(data.buffer, offset, count);**
          }
        }
        if (forceCopy) {
          return data.slice();
        }
        return data;
      }

Are you able to setup a repro in the Playground?

I tried to replicate the important bits of your code, but could not make it fail:

I found the problem, it was in houdini export to glb. I switched to blender and script started working well!