XTLS/Xray-core · error
read login finished fields: %w
Error message
read login finished fields: %w
What it means
readLoginSuccess failed to decode the fields of the server's 0x02 Login Success packet (username, UUID, properties array per this protocol). The packet ID was right but the body did not match the expected field layout — truncation, wrong varint structure, or a version that added/removed fields such as number-of-properties.
Source
Thrown at transport/internet/finalmask/xmc/client.go:211
pkt, err = readPacket(c.reader)
if err != nil {
return fmt.Errorf("read login finished: %w", err)
}
if pkt.packetID == 0x00 {
var reason String
if readErr := pkt.readFields(&reason); readErr != nil {
return fmt.Errorf("authentication rejected")
}
return fmt.Errorf("authentication rejected: %s", reason)
}
if pkt.packetID != 0x02 {
return fmt.Errorf("bad login finished packet id: %d", pkt.packetID)
}
receivedProfile, err := readLoginSuccess(pkt)
if err != nil {
return fmt.Errorf("read login finished fields: %w", err)
}
if receivedProfile != selectedProfile {
return fmt.Errorf("login profile mismatch")
}
loginAcknowledgedLength, err := writePacketWithLength(c.writer, 0x03)
if err != nil {
return fmt.Errorf("write login acknowledged: %w", err)
}
if err = runPaddingSchedule(c.reader, c.writer, true, loginAcknowledgedLength, c.paddingSchedule); err != nil {
return fmt.Errorf("run startup padding: %w", err)
}
packet := newPacketStream(c.reader, c.writer, true)
c.lifecycleMu.Lock()
if c.closed {
c.lifecycleMu.Unlock()
packet.Stop()
return net.ErrClosedView on GitHub (pinned to 7d214f8b09)
Solutions
- Pin client and server to the same release of this codebase so readLoginSuccess matches the writer
- Verify the endpoint is the xmc server, not stock Minecraft
- Inspect the raw decoded body in a debugger if a custom server implementation is in play
Defensive patterns
Strategy: validation
Validate before calling
// guard: assert paired builds before enabling the outbound
if err := verifyPeerBuildInfo(serverEndpoint); err != nil {
return fmt.Errorf("refusing xmc connect, possible protocol skew: %w", err)
} Try / catch
_, err := conn.Read(buf)
if err != nil && strings.Contains(err.Error(), "read login finished fields") {
return fmt.Errorf("login-success schema mismatch (version skew?): %w", err)
} Prevention
- Ship client and server from the same release artifact
- Never mix a stock Minecraft server into an xmc route
- Keep handshake golden tests in CI to catch schema drift
When it happens
Trigger: First Read/Write on the wrapped conn after receiving 0x02; a server built against a different Login Success schema (e.g. including or omitting the properties list present in newer protocol versions) makes readFields fail.
Common situations: Client and server compiled from different xmc/protocol revisions; a real Minecraft server with the modern Login Success layout (UUID as string, plus property count) behind the port.
Related errors
- bad login finished packet id: %d
- authentication rejected
- run startup padding: %w
- empty domain name
- unknown Socks version: {version}
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/fd7d25f815c3949c.
Report an issue: GitHub.