rtk-ai/rtk · error · anyhow::Error
Failed to parse binlog at {}: unsupported binlog format {}
Error message
Failed to parse binlog at {}: unsupported binlog format {} What it means
The binlog header's fileFormatVersion is below 18, the minimum this parser supports. MSBuild binlogs from much older MSBuild versions cannot be decoded by this reader, so it fails fast instead of producing garbage.
Source
Thrown at src/cmds/dotnet/binlog.rs:324
let mut decoder = GzDecoder::new(bytes.as_slice());
let mut payload = Vec::new();
decoder.read_to_end(&mut payload).with_context(|| {
format!(
"Failed to parse binlog at {}: gzip decode failed",
path.display()
)
})?;
let mut reader = BinReader::new(&payload);
let file_format_version = reader
.read_i32_le()
.context("binlog header missing file format version")?;
let _minimum_reader_version = reader
.read_i32_le()
.context("binlog header missing minimum reader version")?;
if file_format_version < 18 {
anyhow::bail!(
"Failed to parse binlog at {}: unsupported binlog format {}",
path.display(),
file_format_version
);
}
let mut parsed = ParsedBinlog::default();
while !reader.is_eof() {
let kind = reader
.read_7bit_i32()
.context("failed to read record kind")?;
if kind == RECORD_END_OF_FILE {
break;
}
match kind {
RECORD_STRING => {View on GitHub (pinned to 36788f6bd4)
Solutions
- Regenerate the binlog with a modern .NET SDK (6.0+ / MSBuild 17+) that emits format version 18+
- Check `dotnet --version` and update the global.json / CI image to a supported SDK
- Verify the file is actually a binlog (starts with the binlog magic bytes) and not a renamed file
Defensive patterns
Strategy: fallback
Validate before calling
fn binlog_version_ok(bytes: &[u8]) -> bool {
if bytes.len() < 12 { return false; }
i32::from_le_bytes([bytes[8], bytes[9], bytes[10], bytes[11]]) >= 18
} Try / catch
match parse_events_from_binlog(&path) {
Ok(b) => use_events(&b),
Err(e) if e.to_string().contains("unsupported binlog format") => {
eprintln!("binlog too old; regenerate with MSBuild 17+ / .NET 6+");
}
Err(e) => return Err(e),
} Prevention
- Pin .NET SDK 6+ / MSBuild 17+ via global.json
- Refresh archived binlogs instead of replaying legacy ones
- Record the SDK version alongside CI artifacts
When it happens
Trigger: Feeding parse_events_from_binlog (via rtk dotnet build/test/restore parsing) a .binlog produced by MSBuild 15.x/16.x (format version < 18), or by a corrupted/garbage file whose first int32 happens to decode as a small version number.
Common situations: Replaying an old archived binlog from a legacy CI server; pointing rtk at a random non-binlog file; an MSBuild/NET SDK pinned to an old version in the project or CI image.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- legacy dictionary format is unsupported
- Failed to parse binlog at {}: empty file
- negative record length: {}
- negative event length: {}
- unexpected end of stream
AI-assisted analysis of rtk-ai/rtk@36788f6bd4 (2026-09-03).
Data as JSON: /api/errors/25126c20ba037384.
Report an issue: GitHub.