zeroclaw-labs/zeroclaw · error · anyhow::Error
Unsupported scroll direction '{direction}'. Use up/down/left
Error message
Unsupported scroll direction '{direction}'. Use up/down/left/right What it means
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.
Source
Thrown at crates/zeroclaw-tools/src/browser.rs:1750
let client = self.active_client()?;
let element = find_element(client, &selector).await?;
hover_element(client, &element).await?;
Ok(json!({
"backend": "rust_native",
"action": "hover",
"selector": selector,
}))
}
BrowserAction::Scroll { direction, pixels } => {
let client = self.active_client()?;
let amount = i64::from(pixels.unwrap_or(600));
let (dx, dy) = match direction.as_str() {
"up" => (0, -amount),
"down" => (0, amount),
"left" => (-amount, 0),
"right" => (amount, 0),
_ => anyhow::bail!(
"Unsupported scroll direction '{direction}'. Use up/down/left/right"
),
};
let position = client
.execute(
"window.scrollBy(arguments[0], arguments[1]); return { x: window.scrollX, y: window.scrollY };",
vec![json!(dx), json!(dy)],
)
.await
.context("Failed to execute scroll script")?;
Ok(json!({
"backend": "rust_native",
"action": "scroll",
"position": position,
}))
}View on GitHub (pinned to 88bb9c8533)
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
Example fix
// before
{"action": "scroll", "direction": "Bottom"}
// after
{"action": "scroll", "direction": "down", "pixels": 4000} Defensive patterns
Strategy: validation
Validate before calling
const SCROLL_DIRECTIONS: &[&str] = &["up", "down", "left", "right"];
let direction = direction.trim().to_lowercase();
if !SCROLL_DIRECTIONS.contains(&direction.as_str()) {
return Err(format!("invalid scroll direction: {direction}"));
} Try / catch
match tool.execute(args).await {
Ok(res) => { /* ... */ }
Err(e) if e.to_string().contains("Unsupported scroll direction") => {
// fix the direction value; retrying unchanged always fails
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: Sending {"action": "scroll", "direction": "UP"}, "top", "bottom", or "vertical" — the comparison is exact and case-sensitive.
Common situations: LLMs inventing 'top'/'bottom' to scroll to page ends; callers forwarding user input without normalizing case; assuming Playwright-style direction names (pageDown, pageUp).
Related errors
- Unsupported find_action '{action}'. Use click/fill/text/hove
- Unsupported browser action: {other}
- Unsupported text browser '{browser}'. Supported: {}
- tunnel.pinggy.region must be one of: us, eu, ap, br, au (or
- jira.allowed_actions contains unknown action: '{}'. Valid: g
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/bf18693937b1381b.
Report an issue: GitHub.