{"record":{"id":"e8ab0a66c910eb84","repo":"deepseek-ai/deepseek-harness","slug":"lsp-message-length-contentlength-exceeds-the","errorCode":null,"errorMessage":"LSP message length ${contentLength} exceeds the ${this.maxMessageBytes}-byte limit","messagePattern":"LSP message length (.+?) exceeds the (.+?)-byte limit","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lsp/lsp-stdio/src/framing.ts","lineNumber":73,"sourceCode":"    return messages\n  }\n\n  /** Parse and consume the next complete message, or report that more bytes are needed. */\n  private next(): { ready: false } | { ready: true; message: unknown } {\n    const separator = this.buffer.indexOf(HEADER_SEPARATOR)\n    if (separator < 0) {\n      if (this.buffer.length > MAX_HEADER_BYTES) {\n        throw new Error(`LSP header exceeded ${MAX_HEADER_BYTES} bytes without a terminator`)\n      }\n      return { ready: false }\n    }\n    if (separator > MAX_HEADER_BYTES) {\n      throw new Error(`LSP header exceeded ${MAX_HEADER_BYTES} bytes`)\n    }\n    const headerText = this.buffer.toString('ascii', 0, separator)\n    const contentLength = parseContentLength(headerText)\n    if (contentLength > this.maxMessageBytes) {\n      throw new Error(`LSP message length ${contentLength} exceeds the ${this.maxMessageBytes}-byte limit`)\n    }\n    const bodyStart = separator + HEADER_SEPARATOR.length\n    const bodyEnd = bodyStart + contentLength\n    if (this.buffer.length < bodyEnd) return { ready: false }\n    const body = this.buffer.toString('utf8', bodyStart, bodyEnd)\n    this.buffer = this.buffer.subarray(bodyEnd)\n    try {\n      return { ready: true, message: JSON.parse(body) }\n    } catch (error) {\n      /* v8 ignore next -- JSON.parse throws a SyntaxError (an Error); the String() fallback is defensive. */\n      throw new Error(`LSP message body was not valid JSON: ${error instanceof Error ? error.message : String(error)}`)\n    }\n  }\n}\n\n/** Read the `Content-Length` header value (case-insensitive), rejecting a missing or non-numeric one. */\nfunction parseContentLength(headerText: string): number {\n  for (const line of headerText.split('\\r\\n')) {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/lsp/lsp-stdio/src/framing.ts#L55-L91","documentation":"Error \"LSP message length ${contentLength} exceeds the ${this.maxMessageBytes}-byte limit\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/lsp/lsp-stdio/src/framing.ts:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise maxMessageBytes for this server, or reduce the size of the LSP messages being exchanged."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}