v2rayA/v2rayA · error

dns upstream: exchange raw tcp fallback: %w

Error message

dns upstream: exchange raw tcp fallback: %w

What it means

Raised in ExchangeRaw when the primary UDP response had the TC (truncated) bit set and the retry over TCP (via a tcp-protocol client) also failed: the full DNS answer could not be retrieved from the upstream after the standard UDP-to-TCP fallback.

Source

Thrown at core/dns/upstream_stub.go:528

		protocol = "udp"
	}

	client := m.getClientForProtocol(upstream, protocol)

	resp, rtt, err := client.Exchange(msg, upstream.Addr)
	if err != nil {
		return nil, rtt, fmt.Errorf("dns upstream: exchange raw: %w", err)
	}

	// Handle UDP truncation → TCP fallback.
	if resp != nil && resp.Truncated && protocol == "udp" {
		log.Printf("[dns upstream] truncated raw response, falling back to TCP: %s",
			upstream.Addr)

		tcpClient := m.getClientForProtocol(upstream, "tcp")
		resp, rtt, err = tcpClient.Exchange(msg, upstream.Addr)
		if err != nil {
			return nil, rtt, fmt.Errorf("dns upstream: exchange raw tcp fallback: %w", err)
		}
	}

	return resp, rtt, nil
}

// exchangeViaDispatcher sends a DNS query through xray-core's internal routing
// dispatcher. It uses the RouteDispatcher to create a connection through
// xray-core's routing engine (like xray-core's traditional DNS module does),
// then performs DNS-over-TCP on that connection.
//
// This replaces the external SOCKS5 proxy approach with v2raya-core's built-in
// routing logic, supporting any outbound type (VMESS, VLESS, Trojan, etc.).
func (m *UpstreamManager) exchangeViaDispatcher(upstream *UpstreamInstance, query *DnsQuery) (*DnsResponse, error) {
	if upstream == nil || m.dispatcher == nil {
		return nil, nil
	}

View on GitHub (pinned to 71e5442fc5)

Solutions

  1. Check whether TCP/53 to the upstream is blocked
  2. Try a different upstream server
  3. Verify overall network connectivity
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/dns/upstream_stub.go:528 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/2e68974fa1021343. Report an issue: GitHub.