TechnitiumSoftware/DnsServer · warning · InvalidDataException
StatCounter version not supported.
Error message
StatCounter version not supported.
What it means
Thrown by the StatCounter(BinaryReader) constructor when the version byte (after 'SC') is not in the handled set {1..9}. Each case migrates an older StatCounter layout (newer versions add fields like authoritative counts, response codes, EDNS, blocked stats, error IP addresses). The default rejects unrecognized versions to prevent buffer misalignment when reading the many counter fields.
Source
Thrown at DnsServerCore/Dns/StatsManager.cs:2059
_queries = new ConcurrentDictionary<DnsQuestionRecord, Counter>(1, count);
for (int i = 0; i < count; i++)
_queries.TryAdd(new DnsQuestionRecord(bR.BaseStream), new Counter(bR.ReadInt64()));
}
if (version <= 8)
{
int count = bR.ReadInt32();
ConcurrentDictionary<IPAddress, Counter> errorIpAddresses = new ConcurrentDictionary<IPAddress, Counter>(1, count);
for (int i = 0; i < count; i++)
errorIpAddresses.TryAdd(IPAddressExtensions.ReadFrom(bR), new Counter(bR.ReadInt64()));
}
break;
default:
throw new InvalidDataException("StatCounter version not supported.");
}
_locked = true;
}
#endregion
#region private
private static List<KeyValuePair<string, T>> GetTopList<T>(List<KeyValuePair<string, T>> list, int limit) where T : DashboardStats.TopStats
{
list.Sort(delegate (KeyValuePair<string, T> item1, KeyValuePair<string, T> item2)
{
return item2.Value.Hits.CompareTo(item1.Value.Hits);
});
if (list.Count > limit)
list.RemoveRange(limit, list.Count - limit);View on GitHub (pinned to d0484b6c1e)
Solutions
- Delete the offending .stat file; the period will be missing from historical stats.
- Upgrade to the build that wrote the file, let it run so old files are superseded, then downgrade if needed.
- Do not share a stats folder across server builds; use a fresh folder per version.
Defensive patterns
Strategy: fallback
Try / catch
try { counter = new StatCounter(bR); }
catch (InvalidDataException ex) when (ex.Message == "StatCounter version not supported.")
{ counter = new StatCounter(); } Prevention
- Do not share a stats folder across server builds.
- Upgrade to the build that wrote the file to drain old stats before downgrading.
When it happens
Trigger: Reading a .stat file whose StatCounter version byte is outside the supported range, typically from a server newer than the running build, a truncated stream, or corruption of the version byte.
Common situations: Server downgrade across a StatCounter format bump; corrupt .stat file; stats folder shared between two server versions.
Related errors
- HourlyStats version not supported.
- StatCounter format is invalid.
- AuthRecordInfo format version not supported.
- CacheRecordInfo format version not supported.
- GenericRecordInfo format version not supported.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/827a3f8d492d3928.
Report an issue: GitHub.