denoland/deno · error

failed to send request to tsc thread

Error message

failed to send request to tsc thread

What it means

Every TypeScript-powered LSP request is shipped over a channel to a dedicated tsc worker thread (cli/lsp/tsc.rs:1589-1605). A failed send means the receiving thread no longer exists: it panicked, crashed, or was shut down. Once this fires, all tsc-backed features (completions, hover, diagnostics, refactorings) fail until the language server restarts; the preceding panic is logged above this error.

Source

Thrown at cli/lsp/tsc.rs:1604

    let (tx, mut rx) = oneshot::channel::<Result<String, AnyError>>();
    let change = self.pending_change.lock().take();

    if self
      .sender
      .send((
        req,
        compiler_options_key.clone(),
        scope.cloned(),
        notebook_uri.cloned(),
        snapshot,
        tx,
        token.clone(),
        change,
        Some(context),
      ))
      .is_err()
    {
      return Err(anyhow!("failed to send request to tsc thread"));
    }
    tokio::select! {
      value = &mut rx => {
        let value = value??;
        let _span = super::logging::lsp_tracing_info_span!("Tsc response deserialization");
        let r = Ok(serde_json::from_str(&value)?);
        self.performance.measure(mark);
        r
      }
      _ = token.cancelled() => {
        Err(anyhow!("request cancelled"))
      }
    }
  }
}

fn get_tag_documentation(
  tag: &JsDocTagInfo,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Restart the language server (VS Code: 'Deno: Restart Language Server'; Neovim: :LspRestart) and retry the edit that failed
  2. Update Deno - tsc-thread panics get patched and the pinned tsc moves with releases
  3. Inspect the LSP log for the panic immediately preceding this error to identify the triggering file/request
  4. Report the panic backtrace to denoland/deno; include the minimal file that triggers it
Defensive patterns

Strategy: retry

Try / catch

// LSP client wrapper: on tsc-thread death, restart the server once, then retry
async function withTscRetry(client, restart, send) {
  try {
    return await send();
  } catch (err) {
    if (/failed to send request to tsc thread/i.test(String(err))) {
      await restart(); // e.g. :LspRestart / 'Deno: Restart Language Server'
      return await send();
    }
    throw err;
  }
}

Prevention

When it happens

Trigger: The tsc thread panics while executing a request (often a tsc-side 'Debug Failure' exception or unreachable code in the pinned compiler); a shutdown race when a window/workspace closes mid-request; the server process is OOM-killed or the thread's runtime aborts.

Common situations: Opening a pathological file that trips a tsc bug; long sessions where an earlier request poisoned the thread; deno lsp behind Neovim/Emacs/VS Code after a crash; version skew after a Deno upgrade mid-session.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/fa9d6f60daa8ea04. Report an issue: GitHub.