Skip to content

bug: attempt to call field (a nil value) #403

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

Closed
2 tasks done
proxima1998 opened this issue Apr 20, 2025 · 1 comment
Closed
2 tasks done

bug: attempt to call field (a nil value) #403

proxima1998 opened this issue Apr 20, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@proxima1998
Copy link

Neovim version (nvim -v)

NVIM v0.11.0

Neovim distribution

N/A

Operating system

Fedora 42 Workstation

Terminal emulator / GUI

Gnome Terminal

Describe the bug

I think it would be better to show you the errors I'm getting.

Image

Screencast.From.2025-04-20.13-42-59.mp4

Expected behavior

I don't know, maybe render .md files without errors.

Healthcheck output

==============================================================================
render-markdown:                     require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 8.3.1
- OK neovim >= 0.11

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- WARNING latex: parser not installed
  - ADVICE:
    - Disable latex support to avoid this warning
    - require('render-markdown').setup({ latex = { enabled = false } })
- OK html: parser installed
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: mini.icons

render-markdown.nvim [executables] ~
- WARNING latex2text: not installed
  - ADVICE:
    - Disable latex support to avoid this warning
    - require('render-markdown').setup({ latex = { enabled = false } })

render-markdown.nvim [conflicts] ~
- ERROR headlines: installed
- ERROR markview: installed
- ERROR Failed to run healthcheck for "render-markdown" plugin. Exception:
  ...lazy/render-markdown.nvim/lua/render-markdown/health.lua:50: attempt to call field 'get_client' (a nil value)

Plugin configuration

local render_markdown = {
	"https://github.com/MeanderingProgrammer/render-markdown.nvim",
	enabled = true, ---@type boolean
	dependencies = {
		"https://github.com/nvim-tree/nvim-web-devicons",
		"https://github.com/nvim-treesitter/nvim-treesitter",
	},
	opts = {
		completions = {
			lsp = { enabled = true },
			blink = { enabled = true },
		},
	},
	config = function(_, opts)
		require("render-markdown").setup(opts)
	end,
}

return render_markdown

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

The weird part is that, this bug doesn't happen all the time.

@proxima1998 proxima1998 added the bug Something isn't working label Apr 20, 2025
MeanderingProgrammer added a commit that referenced this issue Apr 22, 2025
## Details

Issue: #403

The `get` call into `mini.icons` can sometimes be `nil`, while I'm
unable to replicate it we can definitely make this module more robust
by adding more checks than a `pcall` around `require`.

To fix this the logic has been entirely re-written. In addition to
`pcall` we now also:

- validate the required module is not `nil`
- validate that the method we use for the provider is not `nil`
- validate `_G.MiniIcons ~= nil` as specified in the docs

Minor other changes:

- pull `default` configuration directly in state module where needed
- add an `alias` for `dash` width type
- consistently call cache tables  `Cache` and use `class` annotation
- `render.md.BufferConfig` -> `render.md.main.Config`
- directly invalidate state cache in `init` module
@MeanderingProgrammer
Copy link
Owner

I'm not able to reproduce this, but I imagine it's due to having a dependency on nvim-web-devicons while also having mini.icons installed. The plugin prefers to use mini.icons and I guess the pcall around it succeeds but the method we call is not available, no idea how TBH.

Regardless of what's happening I made the integration more robust in this commit: dfffdd2

Can you update and LMK if that resolves the problem? Thanks!

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