microsoft/typescript-go · error

jsonrpc: read content: %w

Error message

jsonrpc: read content: %w

What it means

Error "jsonrpc: read content: %w" thrown in microsoft/typescript-go.

Source

Thrown at internal/jsonrpc/baseproto.go:72

		if bytes.Equal(key, []byte("Content-Length")) {
			contentLength, err = strconv.ParseInt(string(bytes.TrimSpace(value)), 10, 64)
			if err != nil {
				return nil, fmt.Errorf("%w: parse error: %w", ErrInvalidContentLength, err)
			}
			if contentLength < 0 {
				return nil, fmt.Errorf("%w: negative value %d", ErrInvalidContentLength, contentLength)
			}
		}
	}

	if contentLength <= 0 {
		return nil, ErrNoContentLength
	}

	data := make([]byte, contentLength)
	if _, err := io.ReadFull(r.r, data); err != nil {
		return nil, fmt.Errorf("jsonrpc: read content: %w", err)
	}

	return data, nil
}

// Writer writes JSON-RPC messages with Content-Length framing.
type Writer struct {
	w *bufio.Writer
}

// NewWriter creates a new Writer.
func NewWriter(w io.Writer) *Writer {
	return &Writer{
		w: bufio.NewWriter(w),
	}
}

// Write writes a message payload with Content-Length header.

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/jsonrpc/baseproto.go:72 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/c7494c77be05d016. Report an issue: GitHub.