2dust/v2rayN · error · Exception
Received NTP response is too short.
Error message
Received NTP response is too short.
What it means
Thrown when the received datagram (udpReceiveResult) is null or shorter than 11 bytes (4+1+4+2). Despite the 'NTP' wording this guard is tester-agnostic; it asserts any reply is long enough to carry a minimal header. A null/short result means both send/receive attempts failed to yield usable data.
Source
Thrown at v2rayN/ServiceLib.UdpTest/UdpTestService.cs:142
var currentRoundTripTime = stopwatch.Elapsed;
if (currentRoundTripTime < roundTripTime)
{
roundTripTime = currentRoundTripTime;
}
}
catch
{
if (attempt == 1 && roundTripTime == TimeSpan.MaxValue)
{
throw;
}
}
}
if ((udpReceiveResult?.Length ?? 0) < 4 + 1 + 4 + 2)
{
throw new Exception("Received NTP response is too short.");
}
if (udpReceiveResult != null && _udpTest.VerifyAndExtractUdpResponse(udpReceiveResult))
{
return roundTripTime;
}
else
{
throw new Exception("Failed to verify and extract UDP response.");
}
}
}
View on GitHub (pinned to e01717d832)
Solutions
- Confirm the target host/port is reachable through the proxy (e.g. the default DNS 8.8.8.8:53 must be egress-allowed).
- Increase operationTimeout to allow slow UDP replies.
- Verify the proxy actually relays UDP to the target (some proxies accept UDP ASSOCIATE but drop outbound UDP).
- Try a different tester/target to determine whether the target or the relay path is the problem.
- Make the message tester-agnostic (the literal says 'NTP' but applies to DNS/STUN/McBe too) so the cause is not misdiagnosed.
Example fix
// before - misleading 'NTP' label for a generic length check
if ((udpReceiveResult?.Length ?? 0) < 4 + 1 + 4 + 2)
{
throw new Exception("Received NTP response is too short.");
}
// after - generic, informative message
if ((udpReceiveResult?.Length ?? 0) < 4 + 1 + 4 + 2)
{
throw new Exception($"UDP relay returned no usable reply (length={udpReceiveResult?.Length ?? 0}); target may be blocked or the proxy does not relay UDP.");
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check reply presence/length before the strict guard
var len = udpReceiveResult?.Length ?? 0;
if (len < 4 + 1 + 4 + 2)
throw new Exception($"UDP relay returned no usable reply (length={len}); target blocked or proxy does not relay UDP."); Type guard
static bool HasMinReplyLength(byte[] reply, int min) => reply != null && reply.Length >= min;
Try / catch
try
{
await SendUdpRequestAsync(host, port, timeout);
}
catch (Exception ex) when (ex.Message.Contains("too short"))
{
// both attempts yielded no/short data; target unreachable through proxy
} Prevention
- Confirm the target host/port is egress-allowed through the proxy.
- Increase operationTimeout for slow UDP paths.
- Try a different tester/target to isolate target vs relay issues.
- Note the message literally says 'NTP' but applies to all testers.
When it happens
Trigger: After the 2-attempt send/receive loop, udpReceiveResult is null (both attempts threw) or its length is < 11 bytes. The attempt loop only rethrows if attempt==1 AND no successful roundTripTime was recorded, so reaching this check implies attempts failed silently or returned a stub.
Common situations: Proxy accepted the UDP relay but the target never replied (e.g. blocked DNS/ NTP/STUN port); reply was lost over UDP; target server unreachable through the proxy; response arrived but was shorter than expected (truncated relay packet); both attempts timed out.
Related errors
- Failed to verify and extract UDP response.
- Invalid SOCKS5 UDP packet: too short
- SOCKS5 UDP fragmentation is not supported
- Invalid SOCKS5 UDP packet: IPv4 address incomplete
- Invalid SOCKS5 UDP packet: IPv6 address incomplete
AI-assisted analysis of 2dust/v2rayN@e01717d832 (2026-08-13).
Data as JSON: /api/errors/056ecf510f3dc076.
Report an issue: GitHub.