evanw/esbuild · error · Error

The service is no longer running${closeData.reason}

Error message

The service is no longer running${closeData.reason}

What it means

Error "The service is no longer running${closeData.reason}" thrown in evanw/esbuild.

Source

Thrown at lib/shared/common.ts:567

    responseCallbacks = {}
  }

  let sendRequest = <Req, Res>(refs: Refs | null, value: Req, callback: (error: string | null, response: Res | null) => void): void => {
    if (closeData.didClose) return callback('The service is no longer running' + closeData.reason, null)
    let id = nextRequestID++
    responseCallbacks[id] = (error, response) => {
      try {
        callback(error, response as any)
      } finally {
        if (refs) refs.unref() // Do this after the callback so the callback can extend the lifetime if needed
      }
    }
    if (refs) refs.ref()
    streamIn.writeToStdin(protocol.encodePacket({ id, isRequest: true, value: value as any }))
  }

  let sendResponse = (id: number, value: protocol.Value): void => {
    if (closeData.didClose) throw new Error('The service is no longer running' + closeData.reason)
    streamIn.writeToStdin(protocol.encodePacket({ id, isRequest: false, value }))
  }

  let handleRequest = async (id: number, request: any) => {
    // Catch exceptions in the code below so they get passed to the caller
    try {
      if (request.command === 'ping') {
        sendResponse(id, {})
        return
      }

      if (typeof request.key === 'number') {
        const requestCallbacks = requestCallbacksByKey[request.key]
        if (!requestCallbacks) {
          // Ignore invalid commands for old builds that no longer exist.
          // This can happen when "context.cancel" and "context.dispose"
          // is called while esbuild is processing many files in parallel.
          // See https://github.com/evanw/esbuild/issues/3318 for details.

View on GitHub (pinned to 6ff1d8b0d8)

Solutions

  1. Create a new esbuild context/service; the previous one was stopped and cannot be reused
  2. Avoid calling stop() before you are done using the service, and recreate it if needed

Example fix

const ctx = await esbuild.context(options);
// use ctx...
await ctx.dispose(); // only when completely done

When it happens

Trigger: Thrown at lib/shared/common.ts:567 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of evanw/esbuild@6ff1d8b0d8 (2026-08-03). Data as JSON: /data/errors/2e3b643fb6381e29.json. Report an issue: GitHub.