{"record":{"id":"1fbf494cd34ec7aa","repo":"zeroclaw-labs/zeroclaw","slug":"computer-use-sidecar-returned-an-empty-screenshot","errorCode":null,"errorMessage":"computer-use sidecar returned an empty screenshot payload","messagePattern":"computer-use sidecar returned an empty screenshot payload","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/browser.rs","lineNumber":1167,"sourceCode":"                        .as_ref()\n                        .and_then(|d| d.get(\"png_base64\"))\n                        .and_then(|v| v.as_str())\n                        .ok_or_else(|| {\n                            anyhow::Error::msg(crate::i18n::get_required_tool_string(\n                                \"tool-browser-screenshot-error-sidecar-no-png-data\",\n                            ))\n                        })?;\n\n                    // Decode and validate the PNG payload: it must decode to a\n                    // non-empty buffer with a PNG signature. Base64-decodable\n                    // arbitrary bytes are NOT a valid screenshot — writing them\n                    // to the `.png` destination would turn the sidecar boundary\n                    // into an arbitrary decoded-byte write.\n                    let png_bytes = base64::engine::general_purpose::STANDARD\n                        .decode(png_data)\n                        .with_context(|| \"Failed to decode PNG base64 data\")?;\n                    if png_bytes.is_empty() {\n                        anyhow::bail!(crate::i18n::get_required_tool_string(\n                            \"tool-browser-screenshot-error-sidecar-empty-png\",\n                        ));\n                    }\n                    const PNG_SIGNATURE: &[u8] =\n                        &[0x89, b'P', b'N', b'G', b'\\r', b'\\n', 0x1a, b'\\n'];\n                    if !png_bytes.starts_with(PNG_SIGNATURE) {\n                        anyhow::bail!(crate::i18n::get_required_tool_string(\n                            \"tool-browser-screenshot-error-sidecar-not-png\",\n                        ));\n                    }\n\n                    tokio::fs::write(path_str, &png_bytes)\n                        .await\n                        .with_context(|| format!(\"Failed to write screenshot to {path_str}\"))?;\n\n                    // Return success with the path information\n                    let output = serde_json::to_string_pretty(&json!({\n                        \"backend\": \"computer_use\",","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/browser.rs#L1149-L1185","documentation":"For a path-bearing computer-use screenshot, ZeroClaw calls the sidecar, decodes data.png_base64, and requires a non-empty decoded buffer before writing locally. The flow is fail-closed: success must mean the file was actually created, so an empty payload aborts with this error instead of reporting success without a file.","triggerScenarios":"The sidecar replies 2xx with success=true but png_base64=\"\" (or content that decodes to zero bytes) for a screenshot request that carries a destination path.","commonSituations":"Sidecar bug or version mismatch returning a canned/empty payload; screen capture failing silently in headless sessions with no visible window; sidecar stubs in tests returning shape-valid but empty responses.","solutions":["Check the sidecar's own logs for why the capture produced zero bytes","Verify the sidecar version and response contract (ComputerUseResponse with data.png_base64) and upgrade the mismatched side","Retry once — transient capture races can produce empty frames; if it persists, report it as a sidecar bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match tool.execute(args).await {\n    Ok(res) if res.success => { /* file written */ }\n    Ok(res) => {\n        if res.error.as_deref().unwrap_or_default().contains(\"empty screenshot payload\") {\n            // sidecar contract violation: retry once, then report to the sidecar owner\n        }\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Pin and version-check the sidecar contract at startup","Treat empty/non-PNG payload errors as sidecar bugs, not agent mistakes","Run a smoke screenshot against the sidecar during deployment"],"tags":["computer-use","sidecar","screenshot","integration","payload-validation"],"backgroundTag":"empty-response-payload","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}