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: avante always fails with E5108: Error executing lua:, because system_prompt template render fails, missing question field #888

Closed
jmoudrik opened this issue Nov 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jmoudrik
Copy link
Contributor

jmoudrik commented Nov 22, 2024

Describe the bug

Just ,ae or ,aa anything, nvim reports not very verbose exception E5108: Error executing lua:, nothing happens.

The exception happens here:

---@param mode LlmMode
---@param opts TemplateOptions
Prompt.render_mode = function(mode, opts) return templates.render(Prompt.get_file(mode), opts) end

Root cause is that the render dies with deserialize error: missing field 'question'.

This I found by adding some vim.notify & inspect debug prints:

---@param mode LlmMode
---@param opts TemplateOptions
Prompt.render_mode = function(mode, opts)
  local f = Prompt.get_file(mode)
  local status, ret = pcall(templates.render, f, opts)
  if not status then
    vim.notify("f " .. vim.inspect(f), "info")
    vim.notify("opts " .. vim.inspect(opts), "info")
    print("Something went wrong:", ret)
  else
  end
  return ret
end

Which prints:

f "planning.avanterules"
                                                                                                                                                                                                                                                                                                 
opts {                                                                                                                                                                                           
  ask = true,                                                                                                                                                                                   
  code_lang = "typescript",                                                                                                                                                                     
  file_content = "... some of my ugly ts, omiting for brewity ...",                                                                                                                                                                                           
  filepath = "index.ts",                                                                                                                                                                        
  project_context = "null",                                                                                                                                                                     
  use_xml_format = true                                                                                                                                                                         
}                 

Something went wrong: deserialize error: missing field `question`                                                                                                                               
stack traceback:                                                                                                                                                                                
^I[C]: in ?                                                                                                                                                                                     
^I[C]: in function 'pcall'                                                                                                                                                                      
^I...m/.local/share/nvim/lazy/avante.nvim/lua/avante/path.lua:150: in function 'render_mode'      

vanilla install with lazy, main branch current HEAD (934602b), but has been happenning for some time. make BUILD_FROM_SOURCE=true did not help.

To reproduce

No response

Expected behavior

avante works and does not die on exception.

Installation method

{
          "yetone/avante.nvim",
		event = "VeryLazy",
		lazy = false,
		version = false, -- set this if you want to always pull the latest change
		opts = {
			-- add any opts here
		},
		-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
		build = "make",
		dependencies = {
			"nvim-treesitter/nvim-treesitter",
			"stevearc/dressing.nvim",
			"nvim-lua/plenary.nvim",
			"MunifTanjim/nui.nvim",
		},
}

Environment

nvim 0.10.2, clean lazy config. "Ubuntu 24.04 LTS

Repro

No response

@jmoudrik jmoudrik added the bug Something isn't working label Nov 22, 2024
@yetone
Copy link
Owner

yetone commented Nov 23, 2024

Indicates that your avante related DLL is not the latest version and needs to be updated to the latest version:

#882 (comment)

@jmoudrik
Copy link
Contributor Author

@yetone thanks for the hint, but I doubt that is the case, as neither of these works

  • vanilla lazy install
  • build from source
  • manual download && unpack of the 0.0.9 artifacts (luajit, but lua 51 also did not work)

(Also cleaning up avante cache did not help.)

Any pointers as to how can I inspect manually what is the problem?
Thx for help.

@jmoudrik
Copy link
Contributor Author

Ok, fixed. For the reference; issue was that I had some leftover avante dlls in /usr/lib/lua/5.1, from previous development and forgotten about them.. Now I manually inspected the c path of :lua print(package.cpath). Omg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants