Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V7040. Infinite recursion detected.
menu mobile close menu
Analyzing projects
Additional information
toggle menu Contents

V7040. Infinite recursion detected.

Aug 05 2026

The analyzer has detected infinite recursion, which will lead to a stack overflow. The exit condition may have been omitted, or the wrong function may have been called.

The example:

function process(element, condition) {
    const [el, cond] = handle(element, condition)
    const res = process(el, cond)
    ....
}

This recursive function does not check the exit condition. To fix this, add a check on the cond condition.

The fixed code:

function process(element, condition) {
    const [el, cond] = handle(element, condition)
    if (cond) {
        const res = process(el, cond)
        ....
    }
}

This diagnostic rule is classified as: