wezterm/wezterm · error · anyhow::Error

missing history_limit

Error message

missing history_limit

What it means

Final field of WezTerm's tmux window parser: `history_limit` is read with `fields.next()` and parsed as isize. `missing history_limit` means the reply line ended after exactly 7 of 8 tokens — everything through window_layout was present but the per-window scrollback limit never arrived.

Source

Thrown at mux/src/tmux_commands.rs:825

                .next()
                .ok_or_else(|| anyhow!("missing window_height"))?
                .parse()?;
            let window_active = fields
                .next()
                .ok_or_else(|| anyhow!("missing window_active"))?
                .parse::<usize>()?;

            let window_name = fields
                .next()
                .ok_or_else(|| anyhow!("missing window_name"))?;

            let window_layout = fields
                .next()
                .ok_or_else(|| anyhow!("missing window_layout"))?;

            let history_limit = fields
                .next()
                .ok_or_else(|| anyhow!("missing history_limit"))?
                .parse::<isize>()?;

            let window_active = window_active == 1;

            if let Some(x) = self.window_id {
                if x != window_id {
                    continue;
                }
            }

            let layout_csum = window_layout
                .get(0..4)
                .ok_or_else(|| anyhow!("missing window_layout"))?;
            let window_layout = window_layout
                .get(5..)
                .ok_or_else(|| anyhow!("missing window_layout"))?;

            let layout = parse_layout(window_layout)?;

View on GitHub (pinned to 08e5e0afc6)

Solutions

  1. Run `tmux -V` and upgrade to mainstream tmux >= 3.1 (history_limit support in formats is longstanding but old forks vary).
  2. Replay the exact list-windows format under `tmux -CC` and confirm the 8th token appears for every window.
  3. Test with `tmux -f /dev/null`.
  4. Update WezTerm.
  5. Capture the malformed line with WEZTERM_LOG=trace and report upstream.

Example fix

// before
let history_limit = fields
    .next()
    .ok_or_else(|| anyhow!("missing history_limit"))?
    .parse::<isize>()?;

// after
let fields: Vec<&str> = line.split(' ').collect();
anyhow::ensure!(fields.len() >= 8, "malformed list-windows line: {line:?}");
let history_limit: isize = fields[7].parse()?;
Defensive patterns

Strategy: validation

Validate before calling

// history_limit is the 8th and final field
fn window_line_is_complete(line: &str) -> bool {
    !line.is_empty() && line.split(' ').count() >= 8
}

Try / catch

match sync_windows().await {
    Err(e) if e.to_string().contains("missing history_limit") => {
        // trailing field missing: likely incompatible/truncated server output
        log::warn!("tmux omitted history_limit: {e:#}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: A window sync where the captured line stops at 7 tokens. Because this is the trailing field, likely causes are the server truncating the last variable, or a tmux version whose rendering of the fixed `#{...} #{history_limit}` format ends early; stray non-listing lines also land here.

Common situations: `history_limit` as a window format variable exists in modern tmux; very old or patched servers are the usual suspects, plus partial writes under load. The error fails the whole sync round.

Related errors


AI-assisted analysis of wezterm/wezterm@08e5e0afc6 (2026-08-20). Data as JSON: /api/errors/6cb246d4e01180a3. Report an issue: GitHub.