{"record":{"id":"51cf34055ac8e9e1","repo":"neoclide/coc.nvim","slug":"rename-provider-not-found-for-current-buffer","errorCode":null,"errorMessage":"Rename provider not found for current buffer","messagePattern":"Rename provider not found for current buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/handler/refactor/index.ts","lineNumber":69,"sourceCode":"  private setConfiguration(e?: IConfigurationChangeEvent): void {\n    if (e && !e.affectsConfiguration('refactor')) return\n    let config = workspace.getConfiguration('refactor', null)\n    this.config = Object.assign(this.config || {}, {\n      afterContext: config.get('afterContext', 3),\n      beforeContext: config.get('beforeContext', 3),\n      openCommand: config.get('openCommand', 'vsplit'),\n      saveToFile: config.get('saveToFile', true),\n      showMenu: config.get('showMenu', '<Tab>')\n    })\n  }\n\n  /**\n   * Refactor of current symbol\n   */\n  public async doRefactor(): Promise<void> {\n    let { doc, position } = await this.handler.getCurrentState()\n    if (!languages.hasProvider(ProviderName.Rename, doc.textDocument)) {\n      throw new Error(`Rename provider not found for current buffer`)\n    }\n    await doc.synchronize()\n    let edit = await this.handler.withRequestToken('refactor', async token => {\n      let res = await languages.prepareRename(doc.textDocument, position, token)\n      if (token.isCancellationRequested) return null\n      if (res === false) throw new Error(`Provider returns null on prepare, unable to rename at current position`)\n      let edit = await languages.provideRenameEdits(doc.textDocument, position, 'NewName', token)\n      if (token.isCancellationRequested) return null\n      if (!edit) throw new Error('Provider returns null for rename edits.')\n      return edit\n    })\n    if (edit) {\n      await this.fromWorkspaceEdit(edit, doc.filetype)\n    }\n  }\n\n  /**\n   * Search by rg","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/handler/refactor/index.ts#L51-L87","documentation":"doRefactor (refactor of the current symbol) requires the language server for the buffer to register a Rename provider. coc.nvim checks `languages.hasProvider(ProviderName.Rename, ...)` up front and throws before issuing prepareRename. Without this the whole refactor panel cannot be built.","triggerScenarios":"Running `:CocCommand document.renameRefactor` in a buffer whose attached server lacks the `renameProvider` capability, or in a buffer with no attached language server at all.","commonSituations":"Plain/unsupported filetype; old language server without rename support; server failed to initialize so no capabilities registered; invoking the command in a non-code buffer.","solutions":["Attach a capable language server for the filetype (e.g. via a coc extension or lsp config).","Verify with `:CocCommand document.checkBuffer` that rename capability is registered.","If the server crashed at startup, restart coc (`:CocRestart`) and check `:CocInfo`.","Fall back to `:CocRename`-only flow or manual rename when no server supports rename."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// skip when the attached server lacks rename capability\nconst caps = await coc.commands.executeCommand('document.checkBuffer')\nif (!caps?.capabilities?.renameProvider) return","typeGuard":null,"tryCatchPattern":"try {\n  await coc.commands.executeCommand('document.renameRefactor')\n} catch (e) {\n  if (String(e?.message).includes('Rename provider not found'))\n    return vim.notify('Current language server does not support rename')\n  throw e\n}","preventionTips":["Install an lsp/extension with rename support for each code filetype","Verify capabilities with document.checkBuffer before exposing refactor UI","Keep servers updated; restart coc after server install changes"],"tags":["lsp","rename","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"}