microsoft/typescript-go · error

jsonrpc: no content length

Error message

jsonrpc: no content length

What it means

Error "jsonrpc: no content length" thrown in microsoft/typescript-go.

Source

Thrown at internal/jsonrpc/baseproto.go:18

package jsonrpc

import (
	"bufio"
	"bytes"
	"errors"
	"fmt"
	"io"
	"strconv"
)

// Base protocol for JSON-RPC with Content-Length headers (as used by LSP).
// https://microsoft.github.io/language-server-protocol/specifications/base/0.9/specification/

var (
	ErrInvalidHeader        = errors.New("jsonrpc: invalid header")
	ErrInvalidContentLength = errors.New("jsonrpc: invalid content length")
	ErrNoContentLength      = errors.New("jsonrpc: no content length")
)

// Reader reads JSON-RPC messages with Content-Length framing.
type Reader struct {
	r *bufio.Reader
}

// NewReader creates a new Reader.
func NewReader(r io.Reader) *Reader {
	return &Reader{
		r: bufio.NewReader(r),
	}
}

// Read reads the next message payload.
func (r *Reader) Read() ([]byte, error) {
	var contentLength int64

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/jsonrpc/baseproto.go:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/b3e625a6cbca3104. Report an issue: GitHub.