neoclide/coc.nvim · error

select kind "${kind}" not supported

Error message

select kind "${kind}" not supported

What it means

CursorManager.select dispatches on the 'kind' argument; only known kinds (e.g. character-wise selection modes) are handled. Any other kind string reaches the else branch and throws. It signals an unsupported selection kind was requested for multi-cursor selection.

Source

Thrown at src/cursors/index.ts:114

      let line = doc.getline(pos.line)
      if (pos.character >= line.length) {
        range = Range.create(pos.line, Math.max(0, line.length - 1), pos.line, line.length)
      } else {
        range = Range.create(pos.line, pos.character, pos.line, pos.character + 1)
      }
      session.addRange(range)
      await nvim.command(`silent! call repeat#set("\\<Plug>(coc-cursors-${kind})", -1)`)
    } else if (kind == 'range') {
      await nvim.call('eval', 'feedkeys("\\<esc>", "in")')
      let range = await window.getSelectedRange(mode)
      if (range) {
        let ranges = mode == '\x16' ? getVisualRanges(doc, range) : splitRange(doc, range)
        for (let r of ranges) {
          session.addRange(r)
        }
      }
    } else {
      throw new Error(`select kind "${kind}" not supported`)
    }
    session.checkRanges()
  }

  public createSession(doc: Document): CursorSession {
    let { bufnr } = doc
    let session = this.getSession(bufnr)
    if (session) return session
    session = new CursorSession(this.nvim, doc, this.config)
    this.sessionsMap.set(bufnr, session)
    session.onDidCancel(() => {
      session.dispose()
      this.sessionsMap.delete(bufnr)
    })
    return session
  }

  // Add ranges to current document

View on GitHub (pinned to 50e974d969)

Solutions

  1. Use one of the supported kind values accepted by select (check the select signature/docs in src/cursors/index.ts).
  2. Map your custom kind to a supported one before calling select.
  3. Upgrade coc-cursors/coc.nvim if a newer version supports the kind you need.

Example fix

// before
await cursors.select(range, 'block') // throws
// after
await cursors.select(range, 'v') // supported character-wise visual kind
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_KINDS = ['v', '\x16' /* ctrl-v */, 'V']
if (!SUPPORTED_KINDS.includes(kind)) {
  throw new Error(`Unsupported select kind: ${kind}`)
}

Type guard

function isSelectKind(v: unknown): v is 'v' | '\x16' | 'V' {
  return typeof v === 'string' && ['v', '\x16', 'V'].includes(v)
}

Try / catch

try {
  await cursors.select(range, kind)
} catch (e) {
  if (e.message.includes('not supported')) {
    logger.warn(`kind ${kind} unsupported, defaulting to 'v'`)
    await cursors.select(range, 'v')
  } else throw e
}

Prevention

When it happens

Trigger: Calling cursors.select(range, kind) with a kind other than the supported mode characters/values (e.g. 'v', '\x16' visual, or line kinds handled above) — any unrecognized string or number kind.

Common situations: Extension or mapping code passes a descriptive string like 'block' or 'line' that the API doesn't support; copy-pasted code from a different coc-cursors version; typo in the kind parameter.

Related errors


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