neoclide/coc.nvim · warning

Links provider not found.

Error message

Links provider not found.

What it means

The `links` list loads document links for the current buffer via the language client's `getDocumentLinks`. When the language server (or internal provider) returns null instead of an array, coc interprets that as 'no links provider registered for this document' and throws instead of returning an empty list.

Source

Thrown at src/list/source/links.ts:34

    super()

    this.addAction('open', async item => {
      let { target } = item.data
      await workspace.openResource(target)
    })

    this.addAction('jump', async item => {
      let { location } = item.data
      await workspace.jumpTo(location.uri, location.range.start)
    })
  }

  public async loadItems(context: ListContext, token: CancellationToken): Promise<ListItem[]> {
    let buf = await context.window.buffer
    let doc = workspace.getAttachedDocument(buf.id)
    let items: ListItem[] = []
    let links = await languages.getDocumentLinks(doc.textDocument, token)
    if (links == null) throw new Error('Links provider not found.')
    for (let link of links) {
      link = link.target ? link : await languages.resolveDocumentLink(link, token)
      if (link.target) {
        items.push({
          label: formatUri(link.target, workspace.cwd),
          data: {
            target: link.target,
            location: Location.create(doc.uri, link.range)
          }
        })
      }
    }
    return items
  }
}

View on GitHub (pinned to 50e974d969)

Solutions

  1. Install or enable a language server/extension that provides document links for the filetype
  2. Check `:CocCommand workspace.showOutput` to confirm the language server started and advertises documentLinkProvider capability
  3. Verify the buffer's filetype is detected correctly (`:set ft?`) and matches the extension's activation list
  4. Guard the list usage: treat 'Links provider not found' as 'no links available for this file type'
Defensive patterns

Strategy: try-catch

Validate before calling

const doc = workspace.getAttachedDocument(buf.id)
const hasProvider = languages.hasProvider(ProviderName.DocumentLink, { uri: doc.uri, languageId: doc.languageId })
if (!hasProvider) window.showMessage('No document links for this filetype', 'warning')

Try / catch

try {
  await cocList.start(['--normal', 'links'])
} catch (e) {
  if (/Links provider not found/.test(e.message)) {
    window.showMessage('This filetype has no document link provider', 'warning')
  } else throw e
}

Prevention

When it happens

Trigger: Running `:CocList links` in a buffer whose language has no documentLink provider registered, or whose language server returned null for a textDocument/documentLink request.

Common situations: Opening a file type with no LSP server attached (plain text, new buffer); the language server for the filetype failed to start; an LSP server that does not implement the documentLink capability; a broken/changed provider registration after an extension update.

Related errors


AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31). Data as JSON: /api/errors/e0b4c948a43f473e. Report an issue: GitHub.