{"record":{"id":"131a5627c467c33b","repo":"microsoft/typescript-go","slug":"w-expected-fixed-3-element-array-0x93-receive","errorCode":null,"errorMessage":"%w: expected fixed 3-element array (0x93), received: 0x%02x","messagePattern":"%w: expected fixed 3-element array \\(0x93\\), received: 0x%02x","errorType":"validation","errorClass":"ErrInvalidRequest","httpStatus":null,"severity":"error","filePath":"internal/api/protocol_msgpack.go","lineNumber":103,"sourceCode":"\t\tmsg.Error = &jsonrpc.ResponseError{\n\t\t\tCode:    jsonrpc.CodeInternalError,\n\t\t\tMessage: string(payload),\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected message type: %d\", msgType)\n\t}\n\n\treturn msg, nil\n}\n\nfunc (p *MessagePackProtocol) readTuple() (MessageType, string, []byte, error) {\n\t// Read fixed array marker (0x93 = 3-element array)\n\tt, err := p.r.ReadByte()\n\tif err != nil {\n\t\treturn 0, \"\", nil, err\n\t}\n\tif t != msgpackFixedArray3 {\n\t\treturn 0, \"\", nil, fmt.Errorf(\"%w: expected fixed 3-element array (0x93), received: 0x%02x\", ErrInvalidRequest, t)\n\t}\n\n\t// Read message type - can be positive fixint (0x00-0x7F) or uint8 (0xCC + value)\n\tt, err = p.r.ReadByte()\n\tif err != nil {\n\t\treturn 0, \"\", nil, err\n\t}\n\tvar rawType byte\n\tif t <= 0x7F {\n\t\t// Positive fixint - the byte IS the value\n\t\trawType = t\n\t} else if t == msgpackU8 {\n\t\t// uint8 marker - next byte is the value\n\t\trawType, err = p.r.ReadByte()\n\t\tif err != nil {\n\t\t\treturn 0, \"\", nil, err\n\t\t}\n\t} else {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/api/protocol_msgpack.go#L85-L121","documentation":"The first byte of every frame must be the msgpack fixed-array-3 marker 0x93 because each message is a [type, method, payload] tuple. Anything else means the byte stream is not aligned to a message boundary - desynchronized, corrupted, or an entirely different wire format. Wraps ErrInvalidRequest so it is detectable with errors.Is.","triggerScenarios":"A prior partial read left stray bytes; the peer speaks plain JSON-RPC or LSP Content-Length framing on this connection; two bufio.Readers sharing one conn stealing bytes from each other.","commonSituations":"Mixing protocol implementations on one pipe; proxies mangling bytes; constructing the protocol over a conn that something else also reads.","solutions":["Confirm both endpoints were built with NewMessagePackProtocol over the same transport","Ensure exactly one bufio.Reader wraps the connection; sharing it desyncs offsets","When bridging from JSON/LSP, write an explicit translator rather than raw passthrough","Inspect the offending byte: 0x7b ('{') indicates JSON framing; 0x43 indicates 'Content-Length:' headers"],"exampleFix":"// before\nr := bufio.NewReader(conn); r2 := bufio.NewReader(conn) // two readers!\n\n// after\nbr := bufio.NewReader(conn)\nproto := api.NewMessagePackProtocol(readWriter{Reader: br, Writer: conn})","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := proto.ReadMessage()\nif err != nil && errors.Is(err, api.ErrInvalidRequest) {\n\t// framing desync: the byte stream cannot be recovered; close the connection\n\tlog.Printf(\"protocol desync: %v\", err)\n\tconn.Close()\n}","preventionTips":["Construct both ends with NewMessagePackProtocol over one transport","Wrap the conn in exactly one bufio.Reader","Inspect the reported byte: 0x7b means JSON is being spoken; add a translator"],"tags":["go","msgpack","framing","desync","wire-format"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}