Skip to content

Tracer UI reports incorrect/misleading Iteration number when you have more than 20 iterations #24847

Open
@ncd7

Description

@ncd7

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

I understand that the Tracer UI deliberately only preserves the last 20 iterations if a "repeat" loop to keep logs manageable.
However, the current behavior starts off with "Iteration 1" when in reality it should be (max iteration - 20).
Eg below for a repeat loop with 21 iterations, only the last 20 are preserved but instead of the Tracer UI stating "Iteration 2" it says "Iteration 1" which is very confusing.

Image

Describe the behavior you expected

I expect the "Iteration" in the Tracer UI to correctly match the repeat.index value since the actual iteration displayed IS the index-th one.

Steps to reproduce the issue

1.Create a script as below

alias: test
sequence:
  - repeat:
      count: 21
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: "{{ repeat.index|int }}"
description: ""

  1. Run it
  2. Look at "Traces"
  3. Click on the "delay" node and scroll down to the "Changed Variables" tab.
  4. Observe that it starts with "Iteration 1" but it is actually displaying the values of the 2nd iteration, e.g "repeat: first" is false and "repeat: index" is 2.

What version of Home Assistant Core has the issue?

2025.3.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue?

No response

Which operating system are you using to run this browser?

Windows 11

State of relevant entities

Problem-relevant frontend configuration

Javascript errors shown in your browser console/inspector

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions