v2rayA/v2rayA · error
dns read length via dispatcher: %w
Error message
dns read length via dispatcher: %w
What it means
Raised in exchangeViaDispatcher when reading the 2-byte TCP length prefix of the DNS response from the dispatcher connection fails — the upstream/route closed the connection or the 5s read deadline expired before the response header arrived.
Source
Thrown at core/dns/upstream_stub.go:605
}
defer conn.Close()
// DNS over TCP: prepend 2-byte length prefix.
tcpMsg := make([]byte, 2+len(packed))
tcpMsg[0] = byte(len(packed) >> 8)
tcpMsg[1] = byte(len(packed))
copy(tcpMsg[2:], packed)
// Send DNS query.
conn.SetWriteDeadline(time.Now().Add(5 * time.Second))
if _, err := conn.Write(tcpMsg); err != nil {
return nil, fmt.Errorf("dns write via dispatcher: %w", err)
}
// Read 2-byte length prefix.
conn.SetReadDeadline(time.Now().Add(5 * time.Second))
if _, err := conn.Read(tcpMsg[:2]); err != nil {
return nil, fmt.Errorf("dns read length via dispatcher: %w", err)
}
respLen := int(tcpMsg[0])<<8 | int(tcpMsg[1])
if respLen < 0 || respLen > 65535 {
return nil, fmt.Errorf("dns invalid response length: %d", respLen)
}
// Read full DNS response.
respData := make([]byte, respLen)
totalRead := 0
for totalRead < respLen {
n, err := conn.Read(respData[totalRead:])
if err != nil {
return nil, fmt.Errorf("dns read data via dispatcher: %w", err)
}
totalRead += n
}
rtt := time.Since(start)View on GitHub (pinned to 71e5442fc5)
Solutions
- Retry the DNS query
- Check whether the routed outbound actually forwards TCP traffic
- Verify the upstream DNS server responds on TCP
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at core/dns/upstream_stub.go:605 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of v2rayA/v2rayA@71e5442fc5 (2026-09-05).
Data as JSON: /api/errors/8bfe892fd7fe53ff.
Report an issue: GitHub.