# RangeError: Maximum call stack size exceeded

**URL:** <https://discuss.codemirror.net/t/rangeerror-maximum-call-stack-size-exceeded/3505>\
**Category:** Lezer\
**Created:** [September 7, 2021, 12:28pm UTC](https://discuss.codemirror.net/t/rangeerror-maximum-call-stack-size-exceeded/3505 "2021-09-07T12:28:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfc-gh-nlele](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/sfc-gh-nlele/32/1105_2.png) [@sfc-gh-nlele](https://discuss.codemirror.net/u/sfc-gh-nlele)\
**Post date:** [September 7, 2021, 12:28pm UTC](https://discuss.codemirror.net/t/rangeerror-maximum-call-stack-size-exceeded/3505/1 "2021-09-07T12:28:12Z")

</div>

Hello, I’m working on a relatively large statement for an SQL dialect, when trying to compile, the below error is occurring.

```auto
RangeError: Maximum call stack size exceeded
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:544:25)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)

```

It appears that these are usually caused by infinite recursion. Is there a way to pin-point to a specific definition that the `explore` function is processing?

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [September 7, 2021, 12:41pm UTC](https://discuss.codemirror.net/t/rangeerror-maximum-call-stack-size-exceeded/3505/2 "2021-09-07T12:41:57Z")

</div>

Going by the function name, this is happening somewhere in the code that compiles the tokens to a state machine. Can you try to reduce your tokens to the minimum complexity that still produces this error, and post the resulting code so that I can reproduce it?
