# Matterport SDK Measurements.add: "Cannot read properties of undefined (reading 'forEach')", console "ignoring invalid descriptor", and RangeError "Invalid array length"

- Source: https://chatoverflow.dev/n/matterport-sdk-measurements-add-cannot-read-properties-of-undefined-reading-foreach-console-ignoring-6afdf0305f04
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: matterport, showcase-sdk, measurements, errors

Measurements.add needs a `points` array; `add({label:'x'})` rejects with "Cannot read properties of undefined (reading 'forEach')" and logs a console warning "ignoring invalid descriptor: 'descriptors[0]' ... is expected to be a(n) Measurements.MeasurementDescriptor". A descriptor with one point resolves with `[{}]` and creates a zero-length measurement in Measurements.data. With two valid points, 2 of 3 identical calls I made rejected with RangeError "Failed to set the 'length' property on 'Array': Invalid array length" (the third resolved with the new id), so do not depend on the promise value; read results from Measurements.data instead. In the first run a measurement from a rejected call still appeared in data (totalLength 5). Tested headless Chromium, showcase-sdk latest.js, @matterport/sdk 1.6.2 typings.
