{"record":{"id":"a8605193bd7ee486","repo":"rtk-ai/rtk","slug":"negative-event-length","errorCode":null,"errorMessage":"negative event length: {}","messagePattern":"negative event length: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/cmds/dotnet/binlog.rs","lineNumber":364,"sourceCode":"                parsed.string_records.push(text);\n            }\n            RECORD_NAME_VALUE_LIST | RECORD_PROJECT_IMPORT_ARCHIVE => {\n                let len = reader\n                    .read_7bit_i32()\n                    .context(\"failed to read record length\")?;\n                if len < 0 {\n                    anyhow::bail!(\"negative record length: {}\", len);\n                }\n                reader\n                    .skip(len as usize)\n                    .context(\"failed to skip auxiliary record payload\")?;\n            }\n            _ => {\n                let len = reader\n                    .read_7bit_i32()\n                    .context(\"failed to read event length\")?;\n                if len < 0 {\n                    anyhow::bail!(\"negative event length: {}\", len);\n                }\n\n                let payload = reader\n                    .read_exact(len as usize)\n                    .context(\"failed to read event payload\")?;\n                let mut event_reader = BinReader::new(payload);\n                let _ =\n                    parse_event_record(kind, &mut event_reader, file_format_version, &mut parsed);\n            }\n        }\n    }\n\n    Ok(parsed)\n}\n\nfn parse_event_record(\n    kind: i32,\n    reader: &mut BinReader<'_>,","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/rtk-ai/rtk/blob/36788f6bd4932037caac5cbb1d15d6e2fb9f33da/src/cmds/dotnet/binlog.rs#L346-L382","documentation":"Raised while skipping auxiliary binlog records (RECORD_NAME_VALUE_LIST / RECORD_PROJECT_IMPORT_ARCHIVE): the 7-bit-encoded length prefix read from the binary log was negative, meaning the file is corrupted or truncated and the reader cannot safely skip the payload. Not a user-input error — it signals a malformed .binlog file fed to parse_build/parse_test/parse_restore.","triggerScenarios":"parse_events_from_binlog's default record branch reads an event length that is negative, typically because an earlier record was misparsed, the payload was truncated, or the input is not a valid binlog.","commonSituations":"Parsing a partially written .binlog (build crashed); passing an unrelated binary file; version mismatch causing misread record boundaries; corrupted CI artifact.","solutions":["Regenerate the binlog from a fresh, complete build","Verify the file is a genuine .binlog (binlog magic) not a misnamed file","Re-download/re-copy the artifact if it came from a network share or CI cache","If the file opens in the MSBuild Structured Log Viewer, report the parsing bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match parse_events_from_binlog(&path) {\n    Ok(b) => use_events(&b),\n    Err(e) if e.to_string().contains(\"negative event length\") => {\n        eprintln!(\"binlog corrupt or misaligned; regenerate the log\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Confirm the file has the binlog magic header before parsing","Regenerate logs from fresh builds rather than reusing suspect artifacts","Keep rtk updated so parser/format mismatches are fixed upstream"],"tags":["dotnet","binlog","corruption","deserialization"],"backgroundTag":"corrupt-or-truncated-log-file","analyzedSha":"36788f6bd4932037caac5cbb1d15d6e2fb9f33da","analyzedAt":"2026-09-03T16:33:57.738Z","contentChangedAt":"2026-09-03T16:33:57.738Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}