denoland/deno · error

Plugin host has closed

Error message

Plugin host has closed

What it means

When `deno lint` loads plugins, it sends a LoadPlugin request to a dedicated plugin-host worker over a oneshot channel. If the channel receive fails (rx.await is Err) — meaning the host worker terminated before replying — this bail fires. The plugin host died: crashed, exited, or was killed, so plugin metadata can never arrive.

Source

Thrown at cli/tools/lint/plugins.rs:484

    let (tx, rx) = oneshot::channel();
    self
      .tx
      .send(PluginHostRequest::LoadPlugins {
        specifiers,
        exclude_rules,
        tx,
      })
      .await?;

    if let Ok(val) = rx.await {
      let PluginHostResponse::LoadPlugin(result) = val else {
        unreachable!()
      };
      let infos = result?;
      *self.plugin_info.lock() = infos;
      return Ok(());
    }
    bail!("Plugin host has closed")
  }

  pub async fn run_rules(
    &self,
    specifier: &Path,
    serialized_ast: Vec<u8>,
    source_text_info: SourceTextInfo,
    utf16_map: Utf16Map,
    maybe_token: Option<CancellationToken>,
  ) -> Result<Vec<LintDiagnostic>, AnyError> {
    let (tx, rx) = oneshot::channel();
    self
      .tx
      .send(PluginHostRequest::Run {
        serialized_ast,
        file_path: specifier.to_path_buf(),
        source_text_info,
        utf16_map,

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Run `deno lint` in the terminal and read the plugin host's stderr — the crash reason prints above this error
  2. Test the plugin standalone (`deno run plugin.ts`) to find the load-time error
  3. Update the plugin to match your Deno version's lint-plugin API, or pin the Deno version the plugin supports
Defensive patterns

Strategy: try-catch

Validate before calling

# smoke-load the plugin before linting the repo:
deno run --allow-read ./lint-plugin.ts && deno lint

Try / catch

Catch 'Plugin host has closed' during plugin load: log that the plugin host crashed, run `deno run ./plugin.ts` to surface the actual load error, and fail the lint job with that underlying message rather than the generic one.

Prevention

When it happens

Trigger: A lint plugin that panics or calls Deno.exit() during load; the plugin-host worker being killed (OOM, permissions sandbox terminating it); a plugin import path that hangs then dies. rx.await returns Err when the sender is dropped because the host is gone.

Common situations: Plugins written against an older plugin API after a Deno upgrade; plugin files with top-level errors; CI runners with tight memory limits killing the host worker.

Related errors


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