{"record":{"id":"bf18693937b1381b","repo":"zeroclaw-labs/zeroclaw","slug":"unsupported-scroll-direction-direction-use-up","errorCode":null,"errorMessage":"Unsupported scroll direction '{direction}'. Use up/down/left/right","messagePattern":"Unsupported scroll direction '(.+?)'\\. Use up/down/left/right","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/browser.rs","lineNumber":1750,"sourceCode":"                    let client = self.active_client()?;\n                    let element = find_element(client, &selector).await?;\n                    hover_element(client, &element).await?;\n\n                    Ok(json!({\n                        \"backend\": \"rust_native\",\n                        \"action\": \"hover\",\n                        \"selector\": selector,\n                    }))\n                }\n                BrowserAction::Scroll { direction, pixels } => {\n                    let client = self.active_client()?;\n                    let amount = i64::from(pixels.unwrap_or(600));\n                    let (dx, dy) = match direction.as_str() {\n                        \"up\" => (0, -amount),\n                        \"down\" => (0, amount),\n                        \"left\" => (-amount, 0),\n                        \"right\" => (amount, 0),\n                        _ => anyhow::bail!(\n                            \"Unsupported scroll direction '{direction}'. Use up/down/left/right\"\n                        ),\n                    };\n\n                    let position = client\n                        .execute(\n                            \"window.scrollBy(arguments[0], arguments[1]); return { x: window.scrollX, y: window.scrollY };\",\n                            vec![json!(dx), json!(dy)],\n                        )\n                        .await\n                        .context(\"Failed to execute scroll script\")?;\n\n                    Ok(json!({\n                        \"backend\": \"rust_native\",\n                        \"action\": \"scroll\",\n                        \"position\": position,\n                    }))\n                }","sourceCodeStart":1732,"sourceCodeEnd":1768,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/browser.rs#L1732-L1768","documentation":"The rust_native backend implements scroll by translating direction into window.scrollBy deltas: up=(0,-amount), down=(0,amount), left=(-amount,0), right=(amount,0), with amount defaulting to 600 pixels. The match has no fallback mapping, so any direction string outside the four exact lowercase names bails before touching the page.","triggerScenarios":"Sending {\"action\": \"scroll\", \"direction\": \"UP\"}, \"top\", \"bottom\", or \"vertical\" — the comparison is exact and case-sensitive.","commonSituations":"LLMs inventing 'top'/'bottom' to scroll to page ends; callers forwarding user input without normalizing case; assuming Playwright-style direction names (pageDown, pageUp).","solutions":["Use exactly one of up/down/left/right, lowercase","Normalize and trim the direction string before calling","For 'scroll to top', use press with key=\"Home\" instead of an unsupported direction value"],"exampleFix":"// before\n{\"action\": \"scroll\", \"direction\": \"Bottom\"}\n// after\n{\"action\": \"scroll\", \"direction\": \"down\", \"pixels\": 4000}","handlingStrategy":"validation","validationCode":"const SCROLL_DIRECTIONS: &[&str] = &[\"up\", \"down\", \"left\", \"right\"];\nlet direction = direction.trim().to_lowercase();\nif !SCROLL_DIRECTIONS.contains(&direction.as_str()) {\n    return Err(format!(\"invalid scroll direction: {direction}\"));\n}","typeGuard":null,"tryCatchPattern":"match tool.execute(args).await {\n    Ok(res) => { /* ... */ }\n    Err(e) if e.to_string().contains(\"Unsupported scroll direction\") => {\n        // fix the direction value; retrying unchanged always fails\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Normalize direction strings (trim + lowercase) before dispatch","Constrain direction in the tool schema with an enum of the four values","Map UI concepts like 'scroll to top' to press+Home, not invented directions"],"tags":["browser","scroll","enum","argument-validation","case-sensitive"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}