{"record":{"id":"7d093202b9382e4b","repo":"vercel-labs/agent-browser","slug":"provide-a-direction-to-scroll-or-a-selector-to-sc","errorCode":null,"errorMessage":"Provide a direction to scroll, or a selector to scroll into view.","messagePattern":"Provide a direction to scroll, or a selector to scroll into view\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@agent-browser/eve/extension/tools/scroll.ts","lineNumber":23,"sourceCode":"\nexport default defineTool({\n  description:\n    \"Scroll the page or a scrollable container, or scroll an element into view (pass only a selector).\",\n  inputSchema: z.object({\n    direction: z\n      .enum([\"up\", \"down\", \"left\", \"right\"])\n      .optional()\n      .describe(\"Omit to scroll the selector's element into view instead.\"),\n    pixels: z.number().int().positive().optional().describe(\"Scroll distance in pixels.\"),\n    selector: z\n      .string()\n      .optional()\n      .describe(`Scroll container, or the element to bring into view. ${SELECTOR_HINT}`),\n  }),\n  async execute({ direction, pixels, selector }, ctx) {\n    if (direction === undefined) {\n      if (selector === undefined) {\n        throw new Error(\"Provide a direction to scroll, or a selector to scroll into view.\");\n      }\n      return await runBrowser(ctx, [\"scrollintoview\", selector]);\n    }\n    const args = [\"scroll\", direction];\n    if (pixels !== undefined) args.push(String(pixels));\n    if (selector !== undefined) args.push(\"--selector\", selector);\n    return await runBrowser(ctx, args);\n  },\n});\n","sourceCodeStart":5,"sourceCodeEnd":33,"githubUrl":"https://github.com/vercel-labs/agent-browser/blob/548b159b30eef119ccf6846c8bc807d0eaa3f6f8/packages/@agent-browser/eve/extension/tools/scroll.ts#L5-L33","documentation":"The eve 'scroll' tool has two modes: directional scroll (up/down/left/right, optionally with pixels and a container selector) or scroll-into-view (selector only, direction omitted). If direction is undefined the tool needs a selector to bring into view; with both undefined there is no scroll to perform, so execute() throws before running the CLI.","triggerScenarios":"Calling scroll with no arguments at all; passing only pixels ({ pixels: 500 }) without a direction; passing an empty-string direction (schema rejects it, but undefined slips through).","commonSituations":"Models calling scroll as a no-op probe; forgetting that pixels alone does not imply a direction; intending element scroll but omitting the selector.","solutions":["Directional: tools.scroll({ direction: 'down', pixels: 500 })","Into view: tools.scroll({ selector: '@e7' })","Validate that direction or selector is present before invoking"],"exampleFix":"// before\nawait tools.scroll({ pixels: 500 });\n\n// after\nawait tools.scroll({ direction: \"down\", pixels: 500 });\n// or: await tools.scroll({ selector: \"@e7\" });","handlingStrategy":"validation","validationCode":"if (input.direction === undefined && input.selector === undefined) {\n  throw new Error(\"scroll needs a direction or a selector to scroll into view\");\n}\nif (input.pixels !== undefined && input.direction === undefined) {\n  throw new Error(\"pixels only applies together with a direction\");\n}","typeGuard":"function isScrollInputValid(i: { direction?: string; selector?: string }): boolean {\n  return i.direction !== undefined || i.selector !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Choose the mode up front: directional scroll or scroll-into-view","Never send pixels without a direction","For element scrolling pass the selector plus direction and optional pixels"],"tags":["eve","input-validation","scroll"],"backgroundTag":null,"analyzedSha":"548b159b30eef119ccf6846c8bc807d0eaa3f6f8","analyzedAt":"2026-08-16T10:12:14.925Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}