rtk-ai/rtk · warning

a table in the message must not force raw

Error message

a table in the message must not force raw

What it means

Test panic from `.expect("a table in the message must not force raw")`: `condense_unified_diff_strict` returned `Err` on a format-patch whose commit message contains a space-indented markdown table (`col | val`) with ` | ` cells. The parser must recognize the table as prose (not a diffstat), keep parsing, and not fall back to raw output; the test also asserts the bullet after the table stays prose.

Solutions

  1. Log the parser's actual error and the input to see which line the table heuristic trips on.
  2. Require diffstat lines to match the `path | N +-` shape with a leading space AND be followed by the `N file(s) changed` summary line before treating subsequent bullets as marked lines.
  3. If the fallback to raw is correct for some table shapes, restrict the strict-parse test to the space-indented case covered here.

Example fix

// before
.expect("a table in the message must not force raw");
// after
.unwrap_or_else(|e| panic!("a table in the message must not force raw: {e}\n{out}"));
Defensive patterns

Strategy: validation

Validate before calling

// pre-check: prose table lines are indented and not in the diffstat window
let is_diffstat = |l: &str| l.starts_with(' ') && l.contains(" | ") && l.split("|").count() == 2;

Try / catch

let out = condense_unified_diff_strict(&input)
    .unwrap_or_else(|e| panic!("table must not force raw: {e}\n{input}"));

Prevention

When it happens

Trigger: Input with a `Subject: [PATCH]` header, a message body containing ` | `-containing table rows, one `- ` bullet, then `---`, the diffstat ` x.txt | 2 +-`, and a normal diff hunk — a heuristic that treats any post-message `|` line as a marked line or forces raw on table-like content triggers the panic.

Common situations: Commit messages embedding markdown tables (changelogs, benchmark results) collide with diffstat heuristics keyed on ` | `.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19). Data as JSON: /api/errors/1700f850cbae10a7. Report an issue: GitHub.

Appendix: source

Thrown at src/cmds/git/diff_cmd.rs:6917

        // stay prose, which is why the tolerance ends at the diffstat and
        // not at `---`.
        let notes = intact.replace(
            "---\n y.txt | 2 +-",
            "---\nChanges in v2:\n- rebased\n- dropped the hack\n\n y.txt | 2 +-",
        );
        let out = condense_unified_diff_strict(&notes).expect("version notes must stay prose");
        assert!(out.contains("[file] y.txt (+1 -1)"), "got:\n{out}");
        assert!(!out.contains("rebased"), "got:\n{out}");
    }

    #[test]
    fn a_prose_table_is_not_a_diffstat() {
        // A markdown table in the commit message is space-indented and holds
        // a ` | `, but it is prose: the bullet after it must stay prose too,
        // not read as a marked line past the diffstat.
        let base = "From fe6a6d0d8316535b5ac232f5d7cc6d227b187b9e Mon Sep 17 00:00:00 2001\nSubject: [PATCH] one\n\n col | val\n --- | ---\n row | text\n- a bullet after the table\n---\nSTAT\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/x.txt b/x.txt\n--- a/x.txt\n+++ b/x.txt\n@@ -1 +1 @@\n-a\n+b\n-- \n2.54.0\n";
        let out = condense_unified_diff_strict(&base.replace("STAT", " x.txt | 2 +-"))
            .expect("a table in the message must not force raw");
        assert!(out.contains("[file] x.txt (+1 -1)"), "got:\n{out}");
        assert!(!out.contains("bullet"), "got:\n{out}");

        // Every diffstat shape format-patch emits still ends the tolerance,
        // so a marked line after one is still lost content. The bare count
        // covers a pure rename or mode change, which stats as `0`.
        for stat in [
            " x.txt                        |   2 +-",
            " added.txt                    |   1 +",
            " img.png                      | Bin 7 -> 12 bytes",
            " img.png                      | Bin",
            " rename_me.txt => renamed.txt |   0",
            " {a => b}/file.txt            |   2 +-",
            " a | b.txt                    |   2 +-",
        ] {
            let lost = base.replace("STAT", stat).replace(
                "\ndiff --git a/x.txt b/x.txt\n--- a/x.txt\n+++ b/x.txt\n@@ -1 +1 @@\n",
                "\n",

View on GitHub (pinned to 0924356b4c)