neoclide/coc.nvim · error

Unable to open input window

Error message

Unable to open input window

What it means

InputUI.show() calls the Vim script function coc#dialog#create_prompt_win to create the floating input window. The error is thrown when the Vim side returns a falsy result, meaning the floating/popup window could not be created (e.g. no floating window support or the vim function failed). coc.nvim throws this so callers of request()/createInputBox know no input UI exists.

Source

Thrown at src/model/input.ts:157

  }

  public get bufnr(): number | undefined {
    return this._bufnr
  }

  public get winid(): number | undefined {
    return this._winid
  }

  public async show(title: string, preferences: InputPreference): Promise<boolean> {
    this.title = title
    this.borderhighlight = preferences.borderhighlight ?? 'CocFloatBorder'
    this.loading = false
    if (preferences.placeHolder && !this._input && !isVim) {
      this.clear = true
    }
    let res = await this.nvim.call('coc#dialog#create_prompt_win', [title, this._input, omitUndefined(preferences)]) as RequestResult
    if (!res) throw new Error('Unable to open input window')
    this._bufnr = res[0]
    this._winid = res[1]
    this._dimension = res[2]
    return true
  }

  public dispose(): void {
    if (this._disposed) return
    this._disposed = true
    this.nvim.call('coc#float#close', [this._winid ?? -1], true)
    if (isVim) this.nvim.command(`silent! bd! ${this._bufnr}`, true)
    this._onDidFinish.fire(this.accepted ? this._input : null)
    this._winid = undefined
    this._bufnr = undefined
    disposeAll(this.disposables)
  }
}

View on GitHub (pinned to 50e974d969)

Solutions

  1. Upgrade to Vim 8.2+/Neovim 0.4+ compiled with floating window support (check :echo has('float') or has('popupwin'))
  2. Ensure coc.nvim has an attached UI (open a real editor buffer, not --headless) before calling requestInput
  3. Wrap the show()/requestInput() call in try/catch and fall back to input() or another prompt mechanism
  4. Check :CocInfo and terminal capabilities; try a different terminal emulator

Example fix

// before
const val = await workspace.requestInput('Name:')
// after
let val: string | undefined
try {
  val = await workspace.requestInput('Name:')
} catch (e) {
  // floating window unavailable, fall back
  window.showErrorMessage('Input dialog not supported in this environment')
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Vim-side check before invoking the API
// :echo has('float') || has('popupwin')  -> must be 1

Try / catch

try {
  const val = await workspace.requestInput('Name:')
} catch (e) {
  if (e.message.includes('Unable to open input window')) {
    // fallback: notify user or use a non-float prompt
  }
}

Prevention

When it happens

Trigger: Calling await inputBox.show() or await workspace.requestInput() in an environment where coc#dialog#create_prompt_win returns null/0 — typically Vim without +float/+popup support, a terminal without GUI floating support, or an aborted dialog (user/environment cancels creation).

Common situations: Running plain Vim older than 8.2 or a terminal emulator that cannot render floating windows; calling requestInput during startup before the UI is attached (headless/coc-nvim-less buffer); running inside a tmux/screen setup where floats fail.

Related errors


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