{"record":{"id":"95bb9ae3b2d9c30c","repo":"neoclide/coc.nvim","slug":"action-key-doesn-t-exist","errorCode":null,"errorMessage":"Action ${key} doesn't exist","messagePattern":"Action (.+?) doesn't exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/list/mappings.ts","lineNumber":306,"sourceCode":"\n  private addAction(key: string, fn: (expr?: string) => void | Promise<void>): void {\n    this.actions.set(key, fn)\n  }\n\n  public getAction(action: string): () => void | Promise<void> {\n    if (this.actions.has(action)) return () => {\n      return this.doAction(action)\n    }\n    let [key, expr] = action.split(':', 2)\n    if (!expr || !this.actions.has(key)) throw new Error(`Invalid action ${action}`)\n    return () => {\n      return this.doAction(key, expr)\n    }\n  }\n\n  public async doAction(key: string, expr?: string): Promise<void> {\n    let fn = this.actions.get(key)\n    if (!fn) throw new Error(`Action ${key} doesn't exist`)\n    await Promise.resolve(fn(expr))\n  }\n\n  private scrollPreview(dir: 'up' | 'down'): void {\n    const floatPreview = listConfiguration.get<boolean>('floatPreview', false)\n    let { nvim } = this\n    nvim.pauseNotification()\n    nvim.call('coc#list#scroll_preview', [dir, floatPreview], true)\n    nvim.command('redraw', true)\n    nvim.resumeNotification(false, true)\n  }\n}\n","sourceCodeStart":288,"sourceCodeEnd":319,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/list/mappings.ts#L288-L319","documentation":"doAction looks up the handler for the given action key in the registered actions map; if absent it throws. Unlike getAction, this is reached when doAction is invoked directly (or via a previously valid mapping whose action was removed), meaning no handler exists for that key.","triggerScenarios":"Calling mappings.doAction(key) with a key never registered in the actions Map, or an expression dispatched to a key that was unregistered (e.g. by a list extension disposing its mappings).","commonSituations":"Custom list keymappings bound to actions of a list that failed to load; API consumers invoking doAction with internal action names that changed between versions; typos in programmatic dispatch.","solutions":["Verify the action key exists with mappings.hasAction / the registered actions list","Catch the error and fall back to a default action or notify the user","Update bindings after upgrading coc.nvim if action names changed","Register the custom action before dispatching to it"],"exampleFix":"// before\nawait mappings.doAction('refreshx') // typo\n// after\nif (mappings.hasAction('refresh')) await mappings.doAction('refresh')","handlingStrategy":"validation","validationCode":"// Check action existence before dispatch (getAction throws for unknown keys too)\nlet handler\ntry { handler = mappings.getAction(key) } catch { handler = null }\nif (!handler) console.warn(`Action '${key}' is not registered`)","typeGuard":null,"tryCatchPattern":"try {\n  await mappings.doAction(key, expr)\n} catch (e) {\n  if (String(e.message).includes(\"doesn't exist\")) {\n    console.warn(`List action '${key}' missing; was the list extension unloaded?`)\n    return\n  }\n  throw e\n}","preventionTips":["Register custom actions before any dispatch can occur","Re-check action availability after list reload/unload events","Use getAction() to validate keys before direct doAction calls","Pin action names against the coc.nvim version you target"],"tags":["list","mapping","action","configuration"],"backgroundTag":"invalid-action-name","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}