{"id":"0b3f6d50902caaf5","repo":"evanw/esbuild","slug":"cannot-start-service-host-version-esbuild-vers","errorCode":null,"errorMessage":"Cannot start service: Host version \"${ESBUILD_VERSION}\" does not match binary version ${quote(binaryVersion)}","messagePattern":"Cannot start service: Host version \"(.+?)\" does not match binary version (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/shared/common.ts","lineNumber":621,"sourceCode":"        // cause an unhandled promise rejection. Our caller isn't expecting\n        // this call to fail and doesn't handle the promise rejection.\n      }\n    }\n  }\n\n  let isFirstPacket = true\n\n  let handleIncomingPacket = (bytes: Uint8Array<ArrayBuffer>): void => {\n    // The first packet is a version check\n    if (isFirstPacket) {\n      isFirstPacket = false\n\n      // Validate the binary's version number to make sure esbuild was installed\n      // correctly. This check was added because some people have reported\n      // errors that appear to indicate an incorrect installation.\n      let binaryVersion = String.fromCharCode(...bytes)\n      if (binaryVersion !== ESBUILD_VERSION) {\n        throw new Error(`Cannot start service: Host version \"${ESBUILD_VERSION}\" does not match binary version ${quote(binaryVersion)}`)\n      }\n      return\n    }\n\n    let packet = protocol.decodePacket(bytes) as any\n\n    if (packet.isRequest) {\n      handleRequest(packet.id, packet.value)\n    }\n\n    else {\n      let callback = responseCallbacks[packet.id]!\n      delete responseCallbacks[packet.id]\n      if (packet.value.error) callback(packet.value.error, {})\n      else callback(null, packet.value)\n    }\n  }\n","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/evanw/esbuild/blob/6ff1d8b0d8c134e867a397eef39702a223ebef9e/lib/shared/common.ts#L603-L639","documentation":"Error \"Cannot start service: Host version \"${ESBUILD_VERSION}\" does not match binary version ${quote(binaryVersion)}\" thrown in evanw/esbuild.","triggerScenarios":"Thrown at lib/shared/common.ts:621 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reinstall esbuild so the JS package and native binary versions match","Delete node_modules and the lockfile entry for esbuild, then reinstall; ensure optional dependencies are installed"],"exampleFix":"rm -rf node_modules package-lock.json && npm install","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"6ff1d8b0d8c134e867a397eef39702a223ebef9e","analyzedAt":"2026-08-03T19:42:38.433Z","schemaVersion":2}