Repro: snippet self-import causes infinite recursion#155
Conversation
Self-importing snippet (snippets/self.mdx) and a page that renders it. mint dev hangs at 'preparing local preview...' with 100% CPU. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 76883b4. Configure here.
| This snippet imports itself on the line above and renders `<Self />` below. | ||
| A correct loader should detect the self-reference and stop; Mintlify recurses. | ||
|
|
||
| <Self /> No newline at end of file |
There was a problem hiding this comment.
Self-importing snippet causes infinite recursion if merged
High Severity
This PR adds a snippet (snippets/self.mdx) that imports itself and renders <Self />, registered in docs.json navigation. If merged, it triggers infinite recursion in Mintlify's snippet loader — mint dev hangs, production builds fail, and the Node process pins a CPU core at 100%. The PR description states it is "not intended to be merged," making this reproducer-only code that would be destructive in production.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 76883b4. Configure here.


Summary
This is not intended to be merged — it is a minimal reproducer for a Mintlify CLI bug, opened against
mintlify/starterper request so the diff is easy to review.A snippet that imports itself (or two snippets that import each other) sends Mintlify's snippet loader into infinite recursion. The CLI hangs at
preparing local preview…and the underlying Node process pins a CPU core at 100%.Repro
Added on top of
mintlify/starter:snippets/self.mdx— imports itself and renders<Self />inside its own body.snippet-recursion-repro.mdx— page that importssnippets/self.mdx.docs.json— page added to the "Getting started" group.REPRO.md— full write-up.Observed
mint devnever reaches✓ preview ready;@mintlify/cliNode process sits at 100% CPU indefinitely.mint broken-linksnever completes.Expected
The loader should detect a snippet importing itself (or any cycle in the snippet import graph) and either surface a clear error, or stop recursion at the first level.
Notes
AimportsB,BimportsA) exhibit the same behavior.🤖 Generated with Claude Code
Note
Low Risk
Low risk: documentation/content-only changes that add a minimal repro for a CLI bug, with no production logic changes in this repo.
Overview
Adds a minimal reproduction case for an infinite-recursion bug when MDX snippets import themselves (or form cycles).
Introduces
snippets/self.mdx(self-importing snippet) and a new pagesnippet-recursion-repro.mdxthat renders it, wires the page into thedocs.jsonnavigation, and includesREPRO.mdwith steps and expected vs actual behavior.Reviewed by Cursor Bugbot for commit 76883b4. Bugbot is set up for automated code reviews on this repo. Configure here.