telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Module telescope.builtin not found

Open AllergicMushroom opened this issue 5 months ago • 4 comments

Description

I'm getting an error in neovim that wasn't here before. Has anything changed about the configuration of telescope ?

Here's my current configuration :

return {
    'nvim-telescope/telescope.nvim',
    dependencies = { { 'nvim-lua/plenary.nvim' } },
    keys = {
        { '<leader>tf', require('telescope.builtin').find_files, mode = 'n', desc = 'Find files' },
        { '<leader>ts', require('telescope.builtin').live_grep,  mode = 'n', desc = 'Live grep' },
        { '<leader>tb', require('telescope.builtin').buffers,    mode = 'n', desc = 'List buffers' },
        { '<leader>tr', require('telescope.builtin').resume,     mode = 'n', desc = 'Resume picker' },
        { '<leader>to', ':Telescope aerial<CR>', mode = 'n', desc = 'Find outline' },
    },
    extensions = {
        'aerial',
        'fzf'
    },
    config = function()
        require('telescope').load_extension('aerial')
    end
}

I've tried setting the keys with vim.keymap.set inside the config function, and it works.

Neovim version

NVIM v0.11.2
Build type: RelWithDebInfo
LuaJIT 2.1.1748459687

Operating system and version

Linux

Telescope version / branch / rev

master

checkhealth telescope

==============================================================================
telescope:                                                                  ✅

Checking for required plugins ~
- ✅ OK plenary installed.
- ✅ OK nvim-treesitter installed.

Checking external dependencies ~
- ✅ OK rg: found ripgrep 14.1.1
- ✅ OK fd: found fd 10.2.0

===== Installed extensions ===== ~

Telescope Extension: `aerial` ~
- No healthcheck provided

Telescope Extension: `session-lens` ~
- No healthcheck provided

==============================================================================

Steps to reproduce

  1. Put my config file in neovim config.
  2. Launch neovim.

Expected behavior

There's no error and telescope is loaded correctly.

Actual behavior

There's an error and Telescope is not loaded.

Minimal config

return {
    'nvim-telescope/telescope.nvim',
    dependencies = { { 'nvim-lua/plenary.nvim' } },
    keys = {
        { '<leader>tf', require('telescope.builtin').find_files, mode = 'n', desc = 'Find files' },
        { '<leader>ts', require('telescope.builtin').live_grep,  mode = 'n', desc = 'Live grep' },
        { '<leader>tb', require('telescope.builtin').buffers,    mode = 'n', desc = 'List buffers' },
        { '<leader>tr', require('telescope.builtin').resume,     mode = 'n', desc = 'Resume picker' },
        { '<leader>to', ':Telescope aerial<CR>', mode = 'n', desc = 'Find outline' },
    },
    extensions = {
        'aerial',
        'fzf'
    },
    config = function()
        require('telescope').load_extension('aerial')
    end
}

AllergicMushroom avatar Jul 16 '25 18:07 AllergicMushroom

lazy calls require('telescope.builtin').x before telescope is loaded and require call cannot find telescope in your runtime path.

You can either pass a function to each mapping like

{ '<leader>tf', function() require('telescope.builtin').find_files() end, mode = 'n', desc = 'Find files' },

or wrap it in a string

{ '<leader>tf', "<cmd>lua require('telescope.builtin').find_files()<cr>", mode = 'n', desc = 'Find files' },

either one will defer the execution of require after lazy.nvim has loaded the plugin

antonk52 avatar Jul 18 '25 00:07 antonk52

I understand that, but why did it work before ?

AllergicMushroom avatar Jul 18 '25 06:07 AllergicMushroom

I was installing telescope in my new environment and encountered this issue too. The function wrap solution works.

otakutyrant avatar Oct 05 '25 07:10 otakutyrant

I have the same problem, but Termux. On Linux everything works fine.

Image

NTeditor avatar Nov 12 '25 03:11 NTeditor