denoland/deno · error

Unable to convert completion info: {:#}

Error message

Unable to convert completion info: {:#}

What it means

Autocomplete converts tsc's CompletionInfo into LSP completion items (get_completions in the source); this wraps a failure of that conversion. Causes include mapping the replacement range or detail spans against a line index that no longer matches the document (edits between request and conversion), and unexpected completion-entry shapes returned by the embedded TypeScript version.

Source

Thrown at cli/lsp/ts_server.rs:650

          });
        completion_info
          .map(|completion_info| {
            completion_info
              .as_completion_response(
                &module.line_index,
                &snapshot
                  .config
                  .language_settings_for_specifier(&module.specifier)
                  .cloned()
                  .unwrap_or_default()
                  .suggest,
                module,
                position,
                language_server,
                token,
              )
              .map_err(|err| {
                anyhow!("Unable to convert completion info: {:#}", err)
              })
          })
          .transpose()
      }
    }
  }

  pub async fn resolve_completion_item(
    &self,
    module: &DocumentModule,
    item: lsp::CompletionItem,
    data: completions::CompletionItemData,
    snapshot: Arc<StateSnapshot>,
    token: &CancellationToken,
  ) -> Result<lsp::CompletionItem, AnyError> {
    match self {
      Self::Js(ts_server) => {
        let CompletionItemData::TsJs(data) = data else {

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Keep typing or re-open the completion list — the next request re-syncs positions and usually succeeds.
  2. Save the file and retry if one specific completion always fails.
  3. Update the Deno CLI and IDE extension (completion-entry conversion bugs are patched regularly).
  4. Run "Deno: Restart Language Server" if completions stay broken for a file.
Defensive patterns

Strategy: retry

Try / catch

// Completion conversion usually fails against a moving document; re-trigger
// the completion instead of surfacing the internal error.
async function completionsSafe(client, params) {
  try {
    return await client.sendRequest('textDocument/completion', params);
  } catch (err) {
    if (String(err?.message).includes('Unable to convert completion info')) {
      await sleep(200); // let didChange flush
      return await client.sendRequest('textDocument/completion', params);
    }
    throw err;
  }
}

Prevention

When it happens

Trigger: A textDocument/completion request where converting tsc's CompletionInfo fails — typically mid-typing churn where positions moved, or a specific entry (e.g. auto-import data) whose conversion is unsupported.

Common situations: Completion invoked during fast typing so the document changes under the request; a particular symbol or auto-import entry consistently failing conversion in older Deno builds.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/3cba4cab9862f775. Report an issue: GitHub.