{"record":{"id":"21345e03f6c864f3","repo":"neoclide/coc.nvim","slug":"inlay-hint-provider-not-found-for-current-document","errorCode":null,"errorMessage":"Inlay hint provider not found for current document","messagePattern":"Inlay hint provider not found for current document","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/handler/inlayHint/buffer.ts","lineNumber":171,"sourceCode":"    if (Array.isArray(filetypes)) return filetypes.includes('*') || filetypes.includes(this.doc.filetype)\n    return enable === true\n  }\n\n  public enable() {\n    this.checkState()\n    this.config.display = true\n    this.render(undefined, 0).catch(onUnexpectedError)\n  }\n\n  public disable() {\n    this.checkState()\n    this.config.display = false\n    this.clearCache()\n    this.clearVirtualText()\n  }\n\n  private checkState(): void {\n    if (!languages.hasProvider(ProviderName.InlayHint, this.doc.textDocument)) throw new Error('Inlay hint provider not found for current document')\n    if (!this.configEnabled) throw new Error(`Filetype \"${this.doc.filetype}\" not enabled by inlayHint configuration, see ':h coc-config-inlayHint'`)\n  }\n\n  public toggle(): void {\n    if (this.config.display) {\n      this.disable()\n    } else {\n      this.enable()\n    }\n  }\n\n  public clearCache(): void {\n    this.cancel()\n    this.currentHints = []\n    this.regions.clear()\n  }\n\n  public onTextChange(): void {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/handler/inlayHint/buffer.ts#L153-L189","documentation":"coc.nvim throws this when an inlay hint operation (enable/disable/toggle) is requested for a buffer whose language server does not register an InlayHint provider. The handler checks `languages.hasProvider(ProviderName.InlayHint, ...)` before touching virtual text. It is a capability check, not an internal fault.","triggerScenarios":"Calling `:CocCommand document.toggleInlayHints` (enable/disable/toggle) on a document whose LSP server has not declared the `inlayHintProvider` capability, or when no language server is attached at all.","commonSituations":"Editing a filetype with no running LSP (e.g. plain text); an older language server that predates the LSP 3.17 inlayHint feature; a server that supports other features (completion, hover) but not inlay hints.","solutions":["Install or upgrade a language server for the filetype that supports LSP inlayHintProvider (e.g. rust-analyzer, typescript-language-server >= 4).","Verify the server is actually running for the buffer with `:CocCommand workspace.showOutput`.","Check `:CocInfo` / `:CocCommand document.checkBuffer` that a client is attached and which capabilities it registered.","Only toggle inlay hints in buffers with a capable server; gate keybindings by filetype if needed."],"exampleFix":"// before: global keybind always toggles\nvim.api.nvim_set_keymap('n', '<leader>ih', ':CocCommand document.toggleInlayHints<CR>', {})\n// after: guard by capable filetype\nlocal capable = { rust = true, typescript = true }\nvim.keymap.set('n', '<leader>ih', function()\n  if capable[vim.bo.filetype] then vim.cmd('CocCommand document.toggleInlayHints') end\nend, {})","handlingStrategy":"validation","validationCode":"// bail out before toggling when no inlayHint provider exists\nconst hasInlayHints = await coc.services.has('inlayHintProvider') // or track via CocAttachUpdate\nif (!hasInlayHints) return","typeGuard":null,"tryCatchPattern":"try {\n  await coc.commands.executeCommand('document.toggleInlayHints')\n} catch (e) {\n  if (String(e?.message).includes('Inlay hint provider not found')) return vim.notify('No language server with inlay hints')\n  throw e\n}","preventionTips":["Check `:CocCommand document.checkBuffer` before binding inlay-hint toggles","Keep language servers updated to LSP >= 3.17 for inlayHintProvider","Scope the toggle keybinding to filetypes with known inlay-hint support"],"tags":["lsp","inlay-hint","missing-capability","coc-nvim"],"backgroundTag":"lsp-server-capability-not-supported","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}