You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Internal error with recursive tasks and cancellation #3290
When I hit Ctrl+C a bunch while it runs, I get this error:
Traceback (most recent call last):
File "C:\Users\A5rocks\Documents\trio\src\trio\_core\_run.py", line 2875, in unrolled_run
runner.task_exited(task, final_outcome)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\A5rocks\Documents\trio\src\trio\_core\_run.py", line 2053, in task_exited
task._parent_nursery._child_finished(task, outcome)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users\A5rocks\Documents\trio\src\trio\_core\_run.py", line 1270, in _child_finished
reason=f"child task raised exception {outcome.error!r}",
^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\A5rocks\Documents\trio\repro.py", line 23, in <module>
trio.run(main)
~~~~~~~~^^^^^^
File "C:\Users\A5rocks\Documents\trio\src\trio\_core\_run.py", line 2518, in run
timeout = gen.send(next_send)
File "C:\Users\A5rocks\Documents\trio\src\trio\_core\_run.py", line 2931, in unrolled_run
raise TrioInternalError("internal error in Trio - please file a bug!") from exc
trio.TrioInternalError: internal error in Trio - please file a bug!
I am investigating the exception-formatting failure in this traceback. A deterministic variant that raises a deeply nested ExceptionGroup from a child task reaches the same unguarded repr in the nursery cancellation path and produces TrioInternalError.
I plan to guard diagnostic exception formatting in both child-task and nursery-body failure paths, preserving the original exception and ensuring siblings are cancelled and nursery cleanup completes. I will add deterministic regression tests for recursive ExceptionGroup repr and exceptions whose repr raises, and keep the nursery-depth design discussion in #3289 separate.
This investigation and the proposed patch are being prepared by an automated AI coding agent on behalf of Arham-Begani. I checked the contribution guide and found no assignment requirement or separate AI-use restriction; please flag any additional applicable policy.
Activity
goodboy commentedon Jun 19, 2025
No credit to the original author of this ehh
;p
Glad to see you were able to reproduce it!
Arham-Begani commentedon Oct 19, 2026
I am investigating the exception-formatting failure in this traceback. A deterministic variant that raises a deeply nested ExceptionGroup from a child task reaches the same unguarded repr in the nursery cancellation path and produces TrioInternalError.
I plan to guard diagnostic exception formatting in both child-task and nursery-body failure paths, preserving the original exception and ensuring siblings are cancelled and nursery cleanup completes. I will add deterministic regression tests for recursive ExceptionGroup repr and exceptions whose repr raises, and keep the nursery-depth design discussion in #3289 separate.
This investigation and the proposed patch are being prepared by an automated AI coding agent on behalf of Arham-Begani. I checked the contribution guide and found no assignment requirement or separate AI-use restriction; please flag any additional applicable policy.