wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.88k stars 264 forks source link

invalid value (boolean) at index 62 in table for 'concat' #908

Closed winkee01 closed 2 years ago

winkee01 commented 2 years ago

executing :PackerSync causes error: [packer.nvim] [ERROR 16:41:57] async.lua:20: Error in coroutine: ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:706: invalid value (boolean) at index 62 in table for 'concat'

CleanShot 2022-05-09 at 16 42 05@2x
Diullei commented 2 years ago

@winkee01 since you didn't post your packer config, I'm not sure if your problem is the same as I had, but anyway I'll share what worked for me...

I had a similar error when trying to load configuration from one of my packages. I was doing something like:

  use {'projekt0n/github-nvim-theme', config = require("plugins.configs.theme")}

After changing to the code below, it worked again:

  use {'projekt0n/github-nvim-theme', config = function()
      require("plugins.configs.theme")
  end}

As I saw in the documentation the config property expects a string or a function object and if you pass something different you will see an exception similar to the one you posted.

I hope it helps ;)

craigmac commented 2 years ago

@Diullei thanks that worked. Strange thing is, looking through the docs several times config = { ... } is used, or an outright config = { profile = { enable = true, threshold = 1 } } which would lead us to think that it takes a table, must be some kind of metatable magic happening 😕

winkee01 commented 2 years ago

Hi thanks, @Duillei has pointed out the correct solution, you can't pass require()'s result to the config variable because config expects a string/table/funtion, but require() will return a boolean value. I have solved this issue by printing out plugins structure from packer.nvim/lua/packer.lua, just forgot to close the issue.

image