pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error "expected string, got nil" on start

HampusMat opened this issue · comments

Issue Description

Type: bug report

Describe what happened (or what feature you want)

When Neovim starts it displays the following error

Error executing vim.schedule lua callback: vim/shared.lua:0: s: expected string, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'gsplit'
        vim/shared.lua: in function 'split'
        ...im/site/pack/packer/start/octo.nvim/lua/octo/gh/init.lua:98: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

and the Octo command is not available.

Describe what you expected to happen

For no error to be displayed and for Octo to work.

How to reproduce it (as minimally and precisely as possible)

Add the following to your Neovim config file

return require("packer").startup(function(use)
	use {
		"pwntester/octo.nvim",
		requires = {
			"nvim-lua/plenary.nvim",
			"nvim-telescope/telescope.nvim",
			"nvim-tree/nvim-web-devicons",
		},
		config = function ()
			require "octo".setup()
		end
	}
end)
  1. Run PackerCompile
  2. Restart Neovim
  3. Run PackerInstall
  4. Restart Neovim

Tell us your environment

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742
Github CLI 2.42.0
Artix Linux

Anything else we need to know?

This is 100% caused by some commit in #477. I tried using the commit before the pull request was merged (c6b0084) and the problem doesn't occur.

What is the output of gh auth status, specifically the scopes line? We are now doing parsing to figure out which scopes you have to determine if we should or shouldn't show project v2 stuff and the line that the error is occurring is where we use the regex match

Also, what is your gh version? I happen to have 2.41.0, which is not the most recent but it's pretty darn close (only one release old, from last week)

If you happen to have an out-of-date gh then a workaround is to just update it. Long term some error handling should get added here in the event that the scopes go away from the output for whatever reason (which I can submit a PR for later tonight)

@HampusMat I just pushed a small change up #481

Can you verify if that helps for you?

@HampusMat I just pushed a small change up #481

Can you verify if that helps for you?

I had the same issue, and it works for me now. In my case, it may have been because I needed to update GH CLI. I updated and got it to work right around the same time you pushed that change, so I'm not sure what did it but thank you! 🤷

Fixes the original error for me as well, but now there's a message on nvim startup saying Cannot request projects v2, missing scope 'read:project' which seems to be a GH permissions related message that I wasn't getting before.

Yep. That's expected. The most recent changes added projects v2 support, which requires the read:project scope on your token.

You can suppress this warning by setting the following in your config

{
  suppress_missing_scope = {
    projects_v2 = true,
  }
}

Edit: typos

Thank you all! Just merged the fix

Great! I will try it out

It works 🎉

Yep. That's expected. The most recent changes added projects v2 support, which requires the read:proejct scope on your token.

You can suppress this warning by setting the following in your config

{
  suppress_missing_scope = {
    project_v2 = true,
  }
}

For those who are still reading this comment, it should be projects_v2.