rtk-ai/rtk · error · anyhow::Error
Failed to parse binlog at
Error message
Failed to parse binlog at {}: unsupported binlog format {} What it means
parse_events_from_binlog reads the binlog header's file format version and rejects anything below 18 with this error. Binlog format 18 corresponds to a modern MSBuild (Visual Studio 2022 / .NET 6+ era); older formats use different record layouts that this parser does not implement. The message includes the offending version number so the user knows how old their toolchain output is.
Solutions
- Regenerate the binlog with a current SDK: install .NET 8/9 SDK (or VS 2022) and re-run `dotnet build -bl`.
- If the old log must be inspected, open it in the MSBuild Structured Log Viewer version matching its producer instead of this parser.
- Verify the binlog is not truncated/corrupt — re-download or rebuild if the header version looks implausibly low.
- If support for older formats is genuinely needed, extend parse_events_from_binlog to handle file_format_version 6–17 dictionary/record layouts.
Example fix
// before
dotnet build -bl:old.binlog # produced by .NET Core 3.1 SDK
// after
global.json: { "sdk": { "version": "8.0.100" } }
dotnet build -bl:current.binlog Defensive patterns
Strategy: validation
Validate before calling
fn binlog_version_ok(path: &Path) -> anyhow::Result<bool> {
let bytes = std::fs::read(path)?;
let mut d = flate2::read::GzDecoder::new(bytes.as_slice());
let mut hdr = [0u8; 4];
d.read_exact(&mut hdr)?;
Ok(i32::from_le_bytes(hdr) >= 18)
} Type guard
fn supports_binlog(version: i32) -> bool { version >= 18 } Try / catch
match result {
Err(e) if e.to_string().contains("unsupported binlog format") => {
eprintln!("regenerate this log with a modern .NET SDK");
}
other => other?,
} Prevention
- Pin the producing toolchain with global.json to a current SDK (>= .NET 6 / MSBuild 17 era)
- Record the SDK version alongside CI binlog artifacts so old logs are identifiable
- Check `dotnet --info` on build agents before archiving logs for later analysis
- Treat binlogs older than format 18 as incompatible inputs and regenerate rather than parse
When it happens
Trigger: Parsing a .binlog whose first 8 bytes contain file_format_version < 18, e.g. logs produced by MSBuild 15/16 (VS 2017/2019, .NET Core 3.1 era) or by a corrupted file where the version field decodes as a small number.
Common situations: Analyzing binlogs generated on an older build agent or by a legacy .NET Framework MSBuild; sharing build logs from an older CI pipeline; a truncated/corrupt file whose gzip payload decodes with a bogus version header.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
- 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
- invalid 7-bit encoded integer
- negative event length
- negative record length
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/25126c20ba037384.
Report an issue: GitHub.
Appendix: 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 0924356b4c)