Sarven Siege (JavaScript) Unhandled Error

While running Sarven Siege, I recieved this error: “Unhandled error: TypeError: Cannot read propreties of undefined (reading ‘length’)”

I don’t know what this error means. It appears when my summon() function runs. Here’s that portion of the code:

function summon() {
    let tower = hero.findByType("arrow-tower")[0].pos;
    if (tower && >= hero.costOf("griffin-rider")) {
        hero.command(hero.built[hero.built.length - 1], "defend", tower);
while (true) {

I can PM the whole code if it appears to be necessary.

You need to check if there is a tower, hope this works

I did … if (tower ...).

PM me a screenshot of where the error occurs and your code please

I think I know what the issue is

Okay. I just found out that if I summon archers instead of griffin-riders, the error doesn’t occur.

Yeah, there is something wrong with summon sometimes, that’s exactly what I thought the issue was