deepseek-ai/deepseek-harness · error · Error

LSP header block missing Content-Length: ${JSON.stringify(he

Error message

LSP header block missing Content-Length: ${JSON.stringify(headerText)}

What it means

Error "LSP header block missing Content-Length: ${JSON.stringify(headerText)}" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/lsp/lsp-stdio/src/framing.ts:101

      /* v8 ignore next -- JSON.parse throws a SyntaxError (an Error); the String() fallback is defensive. */
      throw new Error(`LSP message body was not valid JSON: ${error instanceof Error ? error.message : String(error)}`)
    }
  }
}

/** Read the `Content-Length` header value (case-insensitive), rejecting a missing or non-numeric one. */
function parseContentLength(headerText: string): number {
  for (const line of headerText.split('\r\n')) {
    const colon = line.indexOf(':')
    if (colon < 0) continue
    if (line.slice(0, colon).trim().toLowerCase() !== 'content-length') continue
    const value = Number(line.slice(colon + 1).trim())
    if (!Number.isInteger(value) || value < 0) {
      throw new Error(`invalid Content-Length header: ${JSON.stringify(line)}`)
    }
    return value
  }
  throw new Error(`LSP header block missing Content-Length: ${JSON.stringify(headerText)}`)
}

View on GitHub (pinned to b150a551b8)

Solutions

  1. Fix the LSP server to include a Content-Length header in each message.

When it happens

Trigger: Thrown at packages/lsp/lsp-stdio/src/framing.ts:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/68227c9de02d05b7. Report an issue: GitHub.