xai-org/grok-build · error
resize failed: {body}
Error message
resize failed: {body} What it means
resize() sends a cols/rows resize request to the session server. A non-2xx response is turned into this error including the server's body text.
Source
Thrown at crates/codegen/ptyctl-cli/src/commands/client.rs:145
/// Resize terminal.
pub async fn resize(url: &str, size: &str) -> Result<()> {
let (cols, rows) = size
.split_once('x')
.ok_or_else(|| anyhow::anyhow!("invalid size format, expected COLSxROWS (e.g. 120x40)"))?;
let cols: u16 = cols.parse().context("invalid cols")?;
let rows: u16 = rows.parse().context("invalid rows")?;
let client = client_for(url)?;
let resp = client
.post(format!("{url}/control/resize"))
.json(&serde_json::json!({"cols": cols, "rows": rows}))
.send()
.await
.context("failed to resize")?;
if !resp.status().is_success() {
let body = resp.text().await.unwrap_or_default();
anyhow::bail!("resize failed: {body}");
}
println!("Resized to {cols}x{rows}");
Ok(())
}
/// Long-poll the wait endpoint; prints the outcome JSON and returns whether it matched.
pub async fn wait(
url: &str,
text: Option<&str>,
regex: Option<&str>,
gone: Option<&str>,
stable_ms: Option<u64>,
timeout_secs: u64,
) -> Result<bool> {
// The HTTP timeout outlasts the wait so the server, not the client, decides the outcome.
#[allow(clippy::disallowed_methods)]
// scheme-aware builder above; loopback skips roots by construction
let client = builder_for(url)View on GitHub (pinned to bc7f02eddd)
Solutions
- Check the error body for the server's reason
- Validate cols/rows are positive before calling
- Verify the session is alive; refresh stale registry entries
- Restart the session and retry
Example fix
// before
client.resize(session, 0, 0).await?;
// after
if cols > 0 && rows > 0 {
client.resize(session, cols, rows).await?;
} Defensive patterns
Strategy: validation
Validate before calling
fn valid_size(cols: u16, rows: u16) -> bool {
cols > 0 && rows > 0 && cols <= 1000 && rows <= 1000
} Prevention
- Clamp dimensions to sane positive bounds before resizing
- Confirm the session is alive before issuing resize
- Refresh stale registry entries that point at dead ports
When it happens
Trigger: POST to the resize endpoint with a non-2xx reply — session gone, port stale, or resize rejected (e.g. invalid dimensions).
Common situations: Automated TUI test harnesses resizing sessions that have exited; stale registry entries pointing at dead ports; zero/negative dimensions.
Related errors
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/40003fcc7d454601.
Report an issue: GitHub.