dashboard-nvim icon indicating copy to clipboard operation
dashboard-nvim copied to clipboard

pcall returning true for a non existing plugin or module

Open Antony-AXS opened this issue 6 months ago • 1 comments

Description

When using pcall to safely load a Lua module via require, the call unexpectedly returns true and a non-nil result (often true), even if the module does not exist in the filesystem. This behavior leads to false positives, making it appear as though the module was loaded successfully.

This issue seems to occur because pcall is returning true for the protected call, even when require fails to find the module. As a result, pcall is unable to reliably distinguish between a successfully loaded module and a missing or unavailable module, leading to subtle bugs when relying on pcall(require, ...) as a check for module existence.

To Reproduce Steps to reproduce the behavior:

  1. type pcall(require("non-existing-package")) in the neovim command line you will get a response like ''true, true"
  2. Since 'strive' is not installed, the error ends up occurring.

https://github.com/user-attachments/assets/73ee0b14-e3e0-4d32-98e6-6cf3d1725f63

Screenshots line number 136 is where the error happens Image

Antony-AXS avatar Apr 30 '25 06:04 Antony-AXS