E5108: Error executing lua: ...lazy/codecompanion.nvim/lua/codecompanion/utils/util.lua:81: stack overflow
...codecompanion.nvim/lua/codecompanion/utils/util.lua:81: in function 'find_key'
Log output
See screenshot...
Health check output
No response
Describe the bug
I have experienced this happening at other random times with other keymaps or actions using the plugin but what I am describing here is a guaranteed reproducible example. I started to do some debugging myself digging into the code and logging but it was getting too complicated without me knowing the ins and the outs and goals of this find_key function. I think you should probably do a deep dive / audit into it because I am pretty sure there are other problems with this, not just this example I am reproducing. Maybe add a recursion limit count and if it hits that, error out and log to the user to report it so that you can determine whether other issues. In my limited testing it seemed like it was recursing a lot given table values that are references to others like Chats and References etc.
Reproduce the bug
Open nvim
Open any buffer
Create a new chat with :CodeCompanionChat
Immediately after that create another new chat with :CodeCompanionChat
Try to cycle between chats with { or }
A stack overflow error is given because of infinite recursion with the find_key function
Final checks
[X] I have made sure this issue exists in the latest version of the plugin
[X] I have tested with the minimal.lua file from above and have shared this
@olimorris fyi this is NOT something that just popped up with the new updates today / yesterday. I recall this happening in the past but just finally able to repro it consistently to report it.
Your
minimal.lua
configConfirmed with minimal config...
Error messages
See screenshot below for full error.
Log output
See screenshot...
Health check output
No response
Describe the bug
I have experienced this happening at other random times with other keymaps or actions using the plugin but what I am describing here is a guaranteed reproducible example. I started to do some debugging myself digging into the code and logging but it was getting too complicated without me knowing the ins and the outs and goals of this find_key function. I think you should probably do a deep dive / audit into it because I am pretty sure there are other problems with this, not just this example I am reproducing. Maybe add a recursion limit count and if it hits that, error out and log to the user to report it so that you can determine whether other issues. In my limited testing it seemed like it was recursing a lot given table values that are references to others like Chats and References etc.
Reproduce the bug
:CodeCompanionChat
:CodeCompanionChat
{
or}
find_key
functionFinal checks
minimal.lua
file from above and have shared this