{"record":{"id":"7ec8d93cfa36c6ec","repo":"neoclide/coc.nvim","slug":"starting-server-failed","errorCode":null,"errorMessage":"Starting server failed","messagePattern":"Starting server failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/language-client/client.ts","lineNumber":1068,"sourceCode":"\n  public start(): Promise<void> & Disposable {\n    let p: any = this._start()\n    p.dispose = () => {\n      if (this.needsStop()) {\n        void this.stop()\n      }\n    }\n    return p\n  }\n\n  private async $start(): Promise<Connection> {\n    if (this.$state === ClientState.StartFailed) {\n      throw new Error(`Previous start failed. Can't restart server.`)\n    }\n    await this._start()\n    const connection = this.activeConnection()\n    if (connection === undefined) {\n      throw new Error(`Starting server failed`)\n    }\n    return connection\n  }\n\n  private handleConnectionEvents(connection: Connection) {\n    connection.onNotification(LogMessageNotification.type, message => {\n      switch (message.type) {\n        case MessageType.Error:\n          this.error(message.message)\n          break\n        case MessageType.Warning:\n          this.warn(message.message)\n          break\n        case MessageType.Info:\n          this.info(message.message)\n          break\n        case MessageType.Debug:\n          this.debug(message.message)","sourceCodeStart":1050,"sourceCodeEnd":1086,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/language-client/client.ts#L1050-L1086","documentation":"Thrown by $start() after awaiting _start() when activeConnection() still returns undefined — i.e., the client reported a successful start sequence but no active connection materialized. This indicates the start promise resolved without the connection being registered (internal race or silent server failure).","triggerScenarios":"Server process spawned but exited before completing initialization while _start still resolved; connection closed asynchronously between _start resolution and activeConnection() read; custom server transports (e.g. child process, socket, worker) failing to attach a connection; timing issue in doInitialize or connection handlers.","commonSituations":"Flaky server binaries that die immediately after spawn; stdio server crashing on startup output; misconfigured socket/piped transports in coc-settings.json; environment issues (missing libraries causing delayed crash).","solutions":["Check :CocCommand workspace.showOutput and server stderr for crash output.","Run the server binary manually to confirm it stays alive and speaks LSP over stdio.","Retry with :CocRestart — transient races usually succeed on a second start.","If using a custom transport (socket/pipe), verify address/port and connection setup.","Update the language server and coc.nvim; report if consistently reproducible."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function startWithRetry(client, attempts = 2) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await client.start()\n    } catch (e) {\n      if (i === attempts - 1 || !String(e).includes('Starting server failed')) throw e\n    }\n  }\n}","preventionTips":["Check server stderr in workspace.showOutput when starts are flaky.","Run the server binary manually to ensure it stays alive over stdio.","Keep server and coc.nvim updated; flaky crash-on-start is often a server bug.","Validate custom transports (socket/pipe addresses) before starting."],"tags":["language-client","server-start","connection","lsp"],"backgroundTag":"server-start-failed","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}