{"record":{"id":"6f802fd82a9b2afc","repo":"xai-org/grok-build","slug":"invalid-size-format-expected-colsxrows-e-g-120x","errorCode":null,"errorMessage":"invalid size format, expected COLSxROWS (e.g. 120x40)","messagePattern":"invalid size format, expected COLSxROWS \\(e\\.g\\. 120x40\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codegen/ptyctl-cli/src/commands/client.rs","lineNumber":131,"sourceCode":"\n/// Query session status.\npub async fn status(url: &str) -> Result<()> {\n    let client = client_for(url)?;\n    let resp = client\n        .get(format!(\"{url}/query/status\"))\n        .send()\n        .await\n        .context(\"failed to query status\")?;\n    let body = resp.text().await?;\n    println!(\"{body}\");\n    Ok(())\n}\n\n/// Resize terminal.\npub async fn resize(url: &str, size: &str) -> Result<()> {\n    let (cols, rows) = size\n        .split_once('x')\n        .ok_or_else(|| anyhow::anyhow!(\"invalid size format, expected COLSxROWS (e.g. 120x40)\"))?;\n    let cols: u16 = cols.parse().context(\"invalid cols\")?;\n    let rows: u16 = rows.parse().context(\"invalid rows\")?;\n\n    let client = client_for(url)?;\n    let resp = client\n        .post(format!(\"{url}/control/resize\"))\n        .json(&serde_json::json!({\"cols\": cols, \"rows\": rows}))\n        .send()\n        .await\n        .context(\"failed to resize\")?;\n\n    if !resp.status().is_success() {\n        let body = resp.text().await.unwrap_or_default();\n        anyhow::bail!(\"resize failed: {body}\");\n    }\n    println!(\"Resized to {cols}x{rows}\");\n    Ok(())\n}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/ptyctl-cli/src/commands/client.rs#L113-L149","documentation":"ptyctl's resize command expects the size argument in the strict COLSxROWS form (e.g. 120x40), parsed by splitting on 'x'. This error is thrown when the string contains no 'x' separator, so it cannot be split into columns and rows.","triggerScenarios":"Running `ptyctl resize <url> <size>` (the resize function in commands/client.rs) with a size like \"120,40\", \"120 40\", \"120*40\", \"120X40\" (capital X), or just \"120\" — any string without a lowercase 'x'.","commonSituations":"Shell scripts using a locale/keyboard that yields a different separator; users typing the size with a space or comma out of habit; copying dimensions from a UI that formats as \"120 × 40\"; forgetting the rows entirely.","solutions":["Pass the size as COLSxROWS with a lowercase x, e.g. 120x40","Replace other separators in your script: convert \"120,40\" or \"120 40\" to \"120x40\"","Check that no shell quoting/variable expansion is mangling the argument before it reaches ptyctl"],"exampleFix":"// before\nptyctl resize http://127.0.0.1:9999 120,40\n// after\nptyctl resize http://127.0.0.1:9999 120x40","handlingStrategy":"validation","validationCode":"fn parse_size(size: &str) -> anyhow::Result<(u16, u16)> {\n    let (c, r) = size.split_once('x').ok_or_else(|| anyhow::anyhow!(\"invalid size format, expected COLSxROWS (e.g. 120x40)\"))?;\n    Ok((c.parse()?, r.parse()?))\n}","typeGuard":null,"tryCatchPattern":"match ptyctl::commands::client::resize(&url, &size).await {\n    Err(e) if e.to_string().contains(\"invalid size format\") => {\n        eprintln!(\"use COLSxROWS, e.g. 120x40 (got: {size})\");\n    }\n    other => other?,\n}","preventionTips":["Always format size as \"{cols}x{rows}\" with a lowercase x and no spaces","Validate user input in shell wrappers before invoking the CLI","Read terminal dimensions programmatically (e.g. stty size) and format them, instead of hand-typing"],"tags":["cli","argument-parsing","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}