{"record":{"id":"d63478f13d9a9cce","repo":"deepseek-ai/deepseek-harness","slug":"invalid-content-length-header-json-stringify-li","errorCode":null,"errorMessage":"invalid Content-Length header: ${JSON.stringify(line)}","messagePattern":"invalid Content-Length header: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lsp/lsp-stdio/src/framing.ts","lineNumber":97,"sourceCode":"    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')) {\n    const colon = line.indexOf(':')\n    if (colon < 0) continue\n    if (line.slice(0, colon).trim().toLowerCase() !== 'content-length') continue\n    const value = Number(line.slice(colon + 1).trim())\n    if (!Number.isInteger(value) || value < 0) {\n      throw new Error(`invalid Content-Length header: ${JSON.stringify(line)}`)\n    }\n    return value\n  }\n  throw new Error(`LSP header block missing Content-Length: ${JSON.stringify(headerText)}`)\n}\n","sourceCodeStart":79,"sourceCodeEnd":103,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/lsp/lsp-stdio/src/framing.ts#L79-L103","documentation":"Error \"invalid Content-Length header: ${JSON.stringify(line)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/lsp/lsp-stdio/src/framing.ts:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the LSP server to emit a valid Content-Length header line."],"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"}