{"record":{"id":"c8db0024ce771b96","repo":"neoclide/coc.nvim","slug":"default-action-defaultaction-not-found","errorCode":null,"errorMessage":"default action \"${defaultAction}\" not found","messagePattern":"default action \"(.+?)\" not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/list/session.ts","lineNumber":285,"sourceCode":"   * Window id used by list.\n   * @returns {number | undefined}\n   */\n  public get winid(): number | undefined {\n    return this.ui.winid\n  }\n\n  public get length(): number {\n    return this.ui.length\n  }\n\n  public get defaultAction(): ListAction {\n    let { defaultAction, actions, name } = this.list\n    let config = workspace.getConfiguration(`list.source.${name}`)\n    let action: ListAction\n    if (config.defaultAction) action = actions.find(o => o.name == config.defaultAction)\n    if (!action) action = actions.find(o => o.name == defaultAction)\n    if (!action) action = actions[0]\n    if (!action) throw new Error(`default action \"${defaultAction}\" not found`)\n    return action\n  }\n\n  public async hide(notify = false, isVim = workspace.isVim): Promise<void> {\n    if (this.hidden) return\n    let { nvim, timer, targetWinid, context } = this\n    let { winid } = this.ui\n    if (timer) clearTimeout(timer)\n    this.worker.stop()\n    this.history.add()\n    this.ui.reset()\n    db.save()\n    this.hidden = true\n    nvim.pauseNotification()\n    if (!isVim) nvim.call('coc#prompt#stop_prompt', ['list'], true)\n    if (winid) nvim.call('coc#list#close', [winid, context.options.position, targetWinid, this.savedHeight], true)\n    if (notify) {\n      nvim.resumeNotification(true, true)","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/list/session.ts#L267-L303","documentation":"The list session resolves which action to run when the user presses Enter. It looks up an action by the `defaultAction` name declared on the list definition, falling back to the first registered action. This error is thrown only when the list defines no actions at all, so there is nothing to fall back to.","triggerScenarios":"Calling a list API (or triggering the default action of a list) whose List definition has an empty `actions` array and whose `defaultAction` name matches no registered action, so `actions.find(...)` twice returns undefined and `actions[0]` is undefined.","commonSituations":"A custom list was registered with no actions or a typo in the action name; a user setting `list.source.<name>.defaultAction` points to a non-existent action but the list itself also has zero actions; a list definition was partially migrated/renamed.","solutions":["Ensure the list definition registers at least one action in its `actions` array","Verify the `defaultAction` name on the list matches one of the registered action names exactly","Check the user config `list.source.<name>.defaultAction` for typos if it is set","Update or reinstall the extension providing the broken list"],"exampleFix":"// before\nlet list = { name: 'mylist', defaultAction: 'open', actions: [] }\n// after\nlet list = { name: 'mylist', defaultAction: 'open', actions: [{ name: 'open', execute: async () => {} }] }","handlingStrategy":"validation","validationCode":"const cfg = workspace.getConfiguration(`list.source.${name}`)\nconst wanted = cfg.defaultAction ?? list.defaultAction\nconst ok = list.actions?.some(a => a.name === wanted)\nif (!ok) throw new Error(`List '${name}' has no action '${wanted}' — check list definition`)\nawait listManager.create(name)","typeGuard":"function hasAction(list: ListInfo, name?: string): boolean {\n  return Array.isArray(list.actions) && list.actions.length > 0 &&\n    (!name || list.actions.some(a => a.name === name))\n}","tryCatchPattern":"try {\n  await session.doAction()\n} catch (e) {\n  if (String(e.message).includes('default action')) {\n    window.showMessage(`List '${listName}' has no valid default action`, 'error')\n  } else throw e\n}","preventionTips":["Always register at least one action in every custom list","Keep defaultAction name in sync with action names when refactoring","Validate user-provided list.source.<name>.defaultAction values against the list's actions","Test each list with :CocList <name> after registration"],"tags":["list","configuration","missing-action"],"backgroundTag":"list-action-not-found","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}