XTLS/Xray-core · error
write login start: %w
Error message
write login start: %w
What it means
Wraps a writePacket failure when sending the Minecraft Login Start packet (packet ID 0x00 carrying the selected profile's username and UUID) right after the protocol handshake. Like error 853, the %w chains the underlying conn write error; this is the second packet on the wire, so failures here mean the connection degraded between the two writes.
Source
Thrown at transport/internet/finalmask/xmc/client.go:117
}
}
err = writePacket(c.writer, 0x00, &protocolVersion, &serverAddress, &serverPort, &nextState)
if err != nil {
return fmt.Errorf("write handshake packet: %w", err)
}
// Login Start
randomProfile, err := rand.Int(rand.Reader, big.NewInt(int64(len(c.profiles))))
if err != nil {
return fmt.Errorf("select profile: %w", err)
}
selectedProfile := c.profiles[randomProfile.Int64()]
username := String(selectedProfile.Username)
err = writePacket(c.writer, 0x00, &username, &selectedProfile.UUID)
if err != nil {
return fmt.Errorf("write login start: %w", err)
}
// Encryption Request
pkt, err := readPacket(c.reader)
if err != nil {
return fmt.Errorf("read encryption request: %w", err)
}
if pkt.packetID != 0x01 {
return fmt.Errorf("bad encrypt request packet id")
}
var (
serverId String
publicKey Bytes
verifyToken Bytes
)
View on GitHub (pinned to 7d214f8b09)
Solutions
- Confirm the target is a Minecraft login server accepting protocol 775 clients.
- Unwrap the error to distinguish timeout vs. ECONNRESET.
- Retry with a fresh connection once transient network issues are ruled out.
Defensive patterns
Strategy: retry
Try / catch
if err := cc.Handshake(); err != nil {
if isWriteErr(err) { // timeout, reset, broken pipe
return retryDial(ctx) // new conn, restart from handshake packet
}
return err
} Prevention
- Confirm the server accepts protocol version 775 logins; some rejections surface as an immediate close after Login Start.
- Size handshake deadlines generously for high-latency paths.
When it happens
Trigger: Server closing the connection after receiving the handshake packet (wrong next-state, protocol version mismatch), write deadline expiry, or a reset from a middlebox. The username/UUID fields are small, so partial-write issues are rare.
Common situations: Protocol version 775 not accepted by the target server; connecting to a Minecraft server in a state that rejects logins (whitelist, full server); network path resetting mid-handshake.
Related errors
- write handshake packet: %w
- read encryption request: %w
- bad encrypt request packet id
- LRU size is bigger than subnet size
- set deadline: %w
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/30435f74fbe9f4be.
Report an issue: GitHub.