The “cannot read properties of undefined (reading ‘length’)” can confuse some, but typically means the object itself is undefined.
That suggest either brevoAccountEmail or hubSpotAccountEmail itself is undefined.
Try console log or return those values right after they are captured, you may have spelled something wrong or there may be more nesting in your json that is required on the variables to get that attribute.
You can also submit your entire flow JSON in a code block (by clicking </>) or using triple backticks, which can help bring people more context:
```
flow code
```
Do not worry, pinned data and anything related to auth is removed.
Looking at your code I am not sure why you are setting the const at the top instead but if you look at your input data only the first 2 items have a brevoUserEmails field so when it checks items 3, 4 and 5 where it is undefined it is throwing an error.
I would recommend checking the item exists first before trying to use it.