Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Callback Error: binary.lua:82: Expected value but found unexpected end of string at character 8127 #167

Closed
jsco2t opened this issue Mar 26, 2024 · 6 comments

Comments

@jsco2t
Copy link

jsco2t commented Mar 26, 2024

Describe the bug
The following error is generated when using /explain-code (in chat-ui):

Error executing vim.schedule lua callback: ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: Expected value but found unexpected end of string at character 8127
stack traceback:
        [C]: in function 'decode'
        ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

To Reproduce
Steps to reproduce the behavior:

  1. Open Golang project
  2. Use :TabnineChat to open chat UI
  3. Use slash command: /explain-code
  4. Select text as requested by chat-ui and ask the chat-ui to continue
  5. While an answer is being streamed into the chat-ui the following error shows up in neovim
Error executing vim.schedule lua callback: ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: Expected value but found unexpected end of string at c
haracter 8127
stack traceback:
        [C]: in function 'decode'
        ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Expected behavior
No error

Version Info:

  • OS: MacOS Sonoma 14.3.1
  • Neovim version (nvim -v): NVIM v0.9.5
  • Tabnine Version:
url    https://github.com/codota/tabnine-nvim
        branch master
        commit 3328272

This is a follow-up to: #151 which was closed as fixed but is not fixed for me.

@amirbilu
Copy link
Contributor

hi @jsco2t can you please provide the go project + what lines exactly are you selecting? is it consistent? for every selection?

@thbishop-intuit
Copy link

thbishop-intuit commented Mar 28, 2024

hi. I'm hitting the same issue. here's the code and error I see in nvim after applying the patch from #94. note that I've redacted most of the fileUri path in the error output but replaced it with the same number of chars. here's what I did:

  1. open main.go
  2. use TabnineChatto open chat ui
  3. select the entire main function (lines 3 - 54)
  4. use slack command /explain-code
  5. the answer is generated in the chat ui and I see the error in nvim.

fwiw, I've also seen similar behavior if instead of /explain-code, I ask it: refactor the selected code to append an increasing integer to the ‘Hello, World!’ message (the incomplete json content in the error is obviously a little different).

I'm using:

# nvim --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188
# sw_vers
ProductName:            macOS
ProductVersion:         14.4
BuildVersion:           23E214
# grep tabnine ~/.config/nvim/lazy-lock.json
  "tabnine-nvim": { "branch": "master", "commit": "f0eb52aaf4992c838b40a3f825459ed5080a128a" },

[edited after]
I forgot to mention, if I remove the patch in #94, I see this:

Error executing vim.schedule lua callback: ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: Expected value but found unexpected end of string at character
 8193
stack traceback:
        [C]: in function 'decode'
        ...share/nvim/lazy/tabnine-nvim/lua/tabnine/chat/binary.lua:82: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

note the char number diff: 8193 in mine vs. 8127 in the bug title/original error message. char 8193 does correspond to the json cutoff in my gist.

@amirbilu
Copy link
Contributor

I'm unable to reproduce this, but I believe I know what the issue is.. give me couple of days to solve this

@amirbilu
Copy link
Contributor

Hi guys, can you test this #168 ?
Appreciate your feedback since i'm not able to test it (does not reproduce to me)

@aarondill aarondill mentioned this issue Mar 30, 2024
@thbishop-intuit
Copy link

Hi @amirbilu. I tested the patch in #168 with my example and it works successfully. I also tested a much larger version of the same function (> 10,000 lines) and it worked successfully as well. Thanks so much for the quick response/patch! 🎉

@amirbilu
Copy link
Contributor

amirbilu commented Apr 1, 2024

Highly appreciated the detailed issue! Merging it now

@amirbilu amirbilu closed this as completed Apr 1, 2024
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

No branches or pull requests

3 participants