Skip to content

Fix RecursionError with cyclic exception chains - #5847

Open
A-G0D wants to merge 1 commit into
robotframework:masterfrom
A-G0D:fix/5842-execution-crashes-with-recursionerror
Open

A-G0D wants to merge 1 commit into
robotframework:masterfrom
A-G0D:fix/5842-execution-crashes-with-recursionerror

Conversation

@A-G0D

@A-G0D A-G0D commented Nov 4, 2026

Copy link
Copy Markdown

ErrorDetails._remove_robot_traces followed __cause__ and __context__ recursively without tracking visited errors, so an exception chain containing a cycle crashed the whole execution with RecursionError instead of failing the keyword. It now walks the chain iteratively and skips errors it has already seen. The unit tests for this area pass, including a new regression test for a self-referential cause. Fixes #5842.

I used DeepSeek V4.1 Flash to draft this patch; I reproduced the bug and ran the tests locally.

`ErrorDetails._remove_robot_traces` followed `__cause__` and
`__context__` recursively without tracking visited errors, so an
exception chain containing a cycle raised `RecursionError` while the
original failure was being handled. Walk the chain iteratively and skip
errors that have already been seen.

Fixes robotframework#5842.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Execution crashes with RecursionError if exception chain contains a cycle

1 participant