Shopify theme check gives false-positive UnclosedHTMLElement warnings

I have reproduced the issue on the latest CLI version.

Yes, I am on the latest version

I have searched existing posts and this report is not a duplicate.

Yes, this isn’t a duplicate

In which of these areas are you experiencing a problem?

Theme

Expected behavior

shopify theme check should handle branching Liquid logic when considering a possible UnclosedHTMLElement warning.

Actual behavior

I get a pair of UnclosedHTMLElement warnings with “Closing tag does not have a matching opening tag” and “Opening tag does not have a matching closing tag”, even though the rendered HTML is actually fine.

Reproduction steps

Create templates/page.test.liquid with something like:

{% assign stuff = "One, Two, Three, Four, Five, Six, Seven, Eight" | split: ", " %}
{% assign breakidx = stuff.size | times: 2 | divided_by: 3 | round %}
{% increment idx %}
<div>
{% for item in stuff %}
{{ item }}
{% if idx == breakidx %}
</div>
<div>
{% endif %}
{% increment idx %}
{% endfor %}
</div>

Verbose output

2026-01-14T16:35:23.496Z: Sync-reading the content of file at templates/page.test.liquid...
2026-01-14T16:35:23.497Z: Sync-reading the content of file at templates/page.test.liquid...
╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  templates/page.test.liquid                                                  │
│                                                                              │
│                                                                              │
│  [warning]: UnclosedHTMLElement                                              │
│  Closing tag does not have a matching opening tag for condition `idx ==      │
│  breakidx` in LiquidBranch 'LiquidBranch'                                    │
│                                                                              │
│  8  </div>                                                                   │
│                                                                              │
│                                                                              │
│  [warning]: UnclosedHTMLElement                                              │
│  Opening tag does not have a matching closing tag for condition `idx ==      │
│  breakidx` in LiquidBranch 'LiquidBranch'                                    │
│                                                                              │
│  9  <div>                                                                    │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Operating system

Mac OS Sonoma

CLI version

3.88.1

Shell

bash

Nodejs version

v25.2.1