denoland/deno · error

Error getting navigation tree for "{}": {:#}

Error message

Error getting navigation tree for "{}": {:#}

What it means

The code lens provider (reference/implementations counts shown above symbols) first asks the embedded TypeScript compiler isolate for the file's navigation tree; this error wraps a failure of that tsc request for the given module specifier. The underlying tsc error text follows the colon. It usually indicates request cancellation or a tsc isolate-level failure for that document, not a problem with the user's source code.

Source

Thrown at cli/lsp/ts_server.rs:221

  }

  pub async fn provide_code_lenses(
    &self,
    module: &DocumentModule,
    settings: &CodeLensSettings,
    snapshot: Arc<StateSnapshot>,
    token: &CancellationToken,
  ) -> Result<Option<Vec<lsp::CodeLens>>, AnyError> {
    match self {
      Self::Js(ts_server) => {
        if !settings.implementations && !settings.references {
          return Ok(None);
        }
        let navigation_tree = ts_server
          .get_navigation_tree(snapshot, module, token)
          .await
          .map_err(|err| {
            anyhow!(
              "Error getting navigation tree for \"{}\": {:#}",
              &module.specifier,
              err,
            )
          })?;
        let code_lenses = crate::lsp::code_lens::collect_tsc(
          &module.uri,
          settings,
          &module.line_index,
          &navigation_tree,
          token,
        )?;
        if code_lenses.is_empty() {
          Ok(None)
        } else {
          Ok(Some(code_lenses))
        }
      }

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Retry by moving the cursor or closing/reopening the file — most navigation-tree failures are transient cancellation races.
  2. Run "Deno: Restart Language Server" from the command palette to reset the tsc isolate.
  3. Read the wrapped error after the colon in the Deno Language Server output panel to identify the real tsc failure.
  4. Update the Deno CLI and IDE extension to matching current versions; as a workaround set deno.codeLens.references and deno.codeLens.implementations to false.
Defensive patterns

Strategy: retry

Try / catch

// Client side: navigation-tree failures are usually transient cancellation
// races. Retry the codeLens request once after a short delay.
async function codeLensWithRetry(client, params) {
  try {
    return await client.sendRequest('textDocument/codeLens', params);
  } catch (err) {
    if (String(err?.message).includes('navigation tree')) {
      await sleep(250);
      return await client.sendRequest('textDocument/codeLens', params);
    }
    throw err;
  }
}

Prevention

When it happens

Trigger: A textDocument/codeLens request while deno.codeLens.references or deno.codeLens.implementations is enabled, and ts_server.get_navigation_tree returns an error — the token was cancelled mid-flight, the tsc worker crashed or is wedged, or the module is in a state tsc cannot process.

Common situations: Large files edited rapidly while lenses are being computed; the language server under memory pressure; older Deno builds with tsc request bugs — typically intermittent in the Deno VS Code extension.

Related errors


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