neoclide/coc.nvim · error
Action "${method}" does not exist
Error message
Action "${method}" does not exist What it means
cocAction() dispatches Vim-originated action requests by looking up the method name in the actions Map. If the name is not registered, it throws this error, meaning Vim called an action the plugin does not provide.
Source
Thrown at src/plugin.ts:287
nvim.resumeNotification(false, true)
void mcp.init(mcpStarted)
const duration = typeof global.__starttime === 'number' ? Date.now() - global.__starttime : 0
logger.info(`coc.nvim initialized with node: ${process.version} after`, duration)
this.ready = true
await events.fire('ready', [])
}
public get isReady(): boolean {
return this.ready
}
public hasAction(method: string): boolean {
return this.actions.has(method)
}
public async cocAction(method: string, ...args: any[]): Promise<any> {
let fn = this.actions.get(method)
if (!fn) throw new Error(`Action "${method}" does not exist`)
return await Promise.resolve(fn.apply(null, args))
}
public getHandler(): Handler {
return this.handler
}
public dispose(): void {
disposeAll(this.disposables)
extensions.dispose()
listManager.dispose()
workspace.dispose()
window.dispose()
sources.dispose()
services.dispose()
snippetManager.dispose()
commandManager.dispose()
completion.dispose()View on GitHub (pinned to 50e974d969)
Solutions
- Verify the action name against current docs (:h coc-actions) and fix typos
- Ensure the extension providing the action is installed and activated before calling it
- Guard in Vim script with coc#client#has_action or check via try/catch around CocAction
- Update mappings/config that reference actions renamed or removed in newer coc.nvim versions
Example fix
" before
noremap <silent> gx :call CocAction('doAction2')<CR>
" after
noremap <silent> gx :call CocAction('doAction')<CR> Defensive patterns
Strategy: try-catch
Validate before calling
" Vim script guard
if coc#client#has_action('myAction')
call CocAction('myAction')
endif Try / catch
try {
await plugin.cocAction('myAction', arg)
} catch (e) {
if (e.message.includes('does not exist')) {
window.showErrorMessage(`Action not available: ${e.message}`)
}
} Prevention
- Verify action names against :h coc-actions for your coc.nvim version
- Ensure the providing extension is installed and activated
- Use hasAction checks before dispatching dynamic action names
- Keep vimrc mappings updated when upgrading coc.nvim
When it happens
Trigger: Calling :call coc#client#request or CocAction('methodName') / CocActionAsync with a name never registered via addAction — including typos, actions from a disabled/unloaded extension, or actions removed in a coc.nvim version upgrade.
Common situations: Old vimrc/plugin configs calling renamed actions after upgrading coc.nvim; invoking an action provided only by an extension that failed to activate; typo'd action names in mappings like nmap <silent> gd :call CocAction('jumpDefinition2').
Related errors
- Command: ${command} not found
- name and doComplete required for createSource
- Feature param could only starts with nvim and patch
- Invalid key ${name} of registerKeymap
- select kind "${kind}" not supported
AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31).
Data as JSON: /api/errors/025e3c261d47d2a4.
Report an issue: GitHub.