# currentIndex Drops to null After 12 Successful Cycles

**URL:** <https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681>\
**Category:** Bug Reports\
**Created:** [September 22, 2025, 9:49pm UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681 "2025-09-22T21:49:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdearmas](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@rdearmas](https://community.mindstudio.ai/u/rdearmas)\
**Post date:** [September 22, 2025, 9:49pm UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681/1 "2025-09-22T21:49:40Z")

</div>

**Describe what happens (in detail):**  
We have an AI Agent that processes rows from a CSV (product catalog) and loops through each product to check for MAP (Minimum Advertised Price) violations.

- The app runs correctly through cycles 0 → 12.

- At each cycle up to 12:

- At cycle 13:

This pattern is 100% reproducible: the workflow works perfectly until cycle 12, then consistently fails at cycle 13.

**Intended behavior:**

- `currentIndex` should increment deterministically on every cycle (`n → n+1`) until `currentIndex >= totalProducts`.

- The loop should continue seamlessly through all rows in the CSV (in our case, 30+ rows).

- At no point should `currentIndex` reset or become `null`.

**Evidence from logs (attached):**

- Cycle 12:

- Cycle 13:

**Why this points to a platform bug (not user code):**

- The increment code is trivial (`currentIndex + 1`). There is no code path that assigns `null`.

- The same block executed correctly for 12 cycles, then suddenly failed with valid input.

- The CSV data is valid and continuous — no gaps at row 13.

- Therefore, the failure is in **MindStudio’s variable persistence across loop transitions**.

**AI Agent link:** [https://app.mindstudio.ai/agents/copy-of-map-guardian-ver-22-2195898e/run](https://app.mindstudio.ai/agents/copy-of-map-guardian-ver-22-2195898e/run)

Run log JSON (showing cycles 0–13 with breakdown):

> **[Dropbox](https://www.dropbox.com/scl/fi/sthwrjwnj4w2isrh4bd99/mindstudio-run-320b8fd1-5f01-4202-8882-77ddbc434232.log.json?rlkey=q2aeywlcwxmptnfn22e9tmbw0&st=0uujwr9f&dl=0)**

---

<div class="post-metadata">

**Author:** ![sean](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@sean](https://community.mindstudio.ai/u/sean)\
**Post date:** [September 23, 2025, 11:44am UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681/2 "2025-09-23T11:44:42Z")

</div>

This is not an error in MindStudio. Your workflow reached the maximum number of steps it is allowed to execute in a single run. You can increase this limit by clicking the agent’s name, selecting “Advanced” and increasing the “Maximum Operations per Invocation” setting.

---

<div class="post-metadata">

**Author:** ![rdearmas](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@rdearmas](https://community.mindstudio.ai/u/rdearmas)\
**Post date:** [September 23, 2025, 4:25pm UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681/3 "2025-09-23T16:25:17Z")

</div>

Thanks for the clarification Sean.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex008/uploads/mindstudio/original/1X/b8a61c98533a48e975398396421002dcae1678e8.jpeg) [@system](https://community.mindstudio.ai/u/system)\
**Post date:** [October 23, 2025, 11:34pm UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681/4 "2025-10-23T23:34:43Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex008/uploads/mindstudio/original/1X/b8a61c98533a48e975398396421002dcae1678e8.jpeg) [@system](https://community.mindstudio.ai/u/system)\
**Post date:** [October 24, 2025, 10:59am UTC](https://community.mindstudio.ai/t/currentindex-drops-to-null-after-12-successful-cycles/1681/5 "2025-10-24T10:59:43Z")

</div>


