Skip to content

Infinite recursion when parsing circular -r references in multiple requirements.txt #15650

@dean-tate

Description

@dean-tate

Summary

Definitely just an edge case but came across this when I inadvertently setup a requirements.txt and requirements-dev.txt file with circular references.

requirements.txt

# Main production dependencies
requests

# Include development requirements
-r requirements-dev.txt

requirements-dev.txt

# Development-specific dependencies
pytest

# Include main requirements
-r requirements.txt

uv pip install -r requirements.txt

Expected Behavior
I would expect uv to detect the circular dependency, issue a warning (e.g., "Skipping circular inclusion of requirements.txt"), and gracefully stop parsing the recursive include rather than crashing.

Actual Behavior
uv crashes with a stack overflow error.

~\uv-recursion-bug via 🐍 v3.13.7 (uv-recursion-bug)

❯ $env:RUST_BACKTRACE=1; uv pip install -r requirements.txt --verbose
DEBUG uv 0.8.14 (af856fb88 2025-08-28)

thread 'main2' has overflowed its stack
error: unhandled exception in uv, please report a bug:
code 0xC00000FD at address 0x7ff6ac0a0c28
EXCEPTION_STACK_OVERFLOW
rax=000005a78e013120 rbx=0000000000000069 rcx=000005a78e61c170
rdx=000005a78e61c170 rsi=0000000000000069 rdi=000005a78e61c170
rsp=0000000d840065f0 rbp=0000000d84006670  r8=000005a78e410400
 r9=0000000000000069 r10=00007ff6acbc0560 r11=0000000000000001
r12=0000000000000020 r13=000000000000001f r14=0000000000000020
r15=000005a78e410400 rip=00007ff6ac0a0c28 eflags=0000000000010216
stack backtrace:
Image

Platform

Microsoft Windows 11 Enterprise 10.0.26100 64-bit

Version

uv 0.8.14 (af856fb 2025-08-28)

Python version

Python 3.13.7

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions