You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codeium sometimes crashes with Vim:E474: String ... contains byte that does not start any UTF-8 character when trying to generate completions on buffers containing non-UTF-8 or binary-like content.
How to Reproduce
Open a .min.js, .mjs, or .pem file, or any non-UTF-8 content
Start typing to trigger completions
Neovim crashes with this error:
[C]: in function 'json_encode'
.../codeium.nvim/lua/codeium/io.lua:410: in function 'post'
...
Cause
vim.fn.json_encode() is being called on raw buffer content without verifying if the buffer:
Is valid UTF-8
Is of a proper filetype (nofile, prompt, etc.)
Should be excluded (Telescope, Spectre, etc.)
Suggested Fix
Wrap vim.fn.json_encode(payload) in pcall() to avoid crashing: