neoclide/coc.nvim · error
${name} not exists
Error message
${name} not exists What it means
Remote (vim-script) completion sources expose config/complete functions whose names may be capitalized or not; getMethodName normalizes the case and throws when neither the given name nor its capitalized variant is found in the list of functions exported by the vim source file. It means the .vim source does not provide the expected function.
Source
Thrown at src/completion/source-vim.ts:16
'use strict'
import { Range } from 'vscode-languageserver-types'
import { getLineAndPosition } from '../core/ui'
import snippetManager from '../snippets/manager'
import { CancellationToken } from '../util/protocol'
import { byteSlice, characterIndex } from '../util/string'
import workspace from '../workspace'
import Source from './source'
import * as Is from '../util/is'
import { CompleteOption, CompleteResult, ExtendedCompleteItem } from './types'
export function getMethodName(name: string, names: ReadonlyArray<string>): string | undefined {
if (names.includes(name)) return name
let key = name[0].toUpperCase() + name.slice(1)
if (names.includes(key)) return key
throw new Error(`${name} not exists`)
}
export function checkInclude(name: string, fns: ReadonlyArray<string>): boolean {
if (fns.includes(name)) return true
let key = name[0].toUpperCase() + name.slice(1)
return fns.includes(key)
}
export default class VimSource extends Source {
private async callOptionalFunc(fname: string, args: any[], isNotify = false): Promise<any> {
let exists = checkInclude(fname, this.remoteFns)
if (!exists) return null
let name = `coc#source#${this.name}#${getMethodName(fname, this.remoteFns)}`
if (isNotify) return this.nvim.call(name, args, true)
return await this.nvim.call(name, args)
}
View on GitHub (pinned to 50e974d969)
Solutions
- Ensure the .vim source defines both coc#source#<name>#init and coc#source#<name>#complete (any capitalization)
- Fix the function name casing in the source file
- Update or reinstall the completion source plugin
Example fix
// before (in the .vim source) function! coc#source#mytag#Complet(...) // after function! coc#source#mytag#complete(...)
Defensive patterns
Strategy: validation
Validate before calling
// verify the vim source exports required fns before loading
const fns = await nvim.call('coc#_remote_fns', name)
const has = (n) => fns.includes(n) || fns.includes(n[0].toUpperCase() + n.slice(1))
if (!has('init') || !has('complete')) throw new Error(`source ${name} incomplete`) Type guard
const isValidVimSource = (fns) =>
Array.isArray(fns) && ['init','complete'].every(n =>
fns.includes(n) || fns.includes(n[0].toUpperCase() + n.slice(1))) Prevention
- Define both init and complete functions in every .vim completion source
- Keep function naming consistent with current coc source API
- Test source loading with :CocList sources after changes
When it happens
Trigger: A remote vim completion source file (autoload function set) lacks the required 'init' or 'complete' function (in either casing), so creating the source via createVimSources fails.
Common situations: Third-party .vim completion sources written against an old coc convention; typos like 'Complet' vs 'complete' in the source file's function names.
Related errors
AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31).
Data as JSON: /api/errors/53c0e7d310337ad0.
Report an issue: GitHub.