{"record":{"id":"a6be94bdc628ba24","repo":"vercel-labs/agent-browser","slug":"provide-at-least-one-of-selector-text-urlpatter","errorCode":null,"errorMessage":"Provide at least one of: selector, text, urlPattern, loadState, jsCondition, timeMs.","messagePattern":"Provide at least one of: selector, text, urlPattern, loadState, jsCondition, timeMs\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@agent-browser/eve/extension/tools/wait_for.ts","lineNumber":74,"sourceCode":"    }\n    if (selector !== undefined) {\n      waits.push({ args: [\"wait\", selector], condition: `element ${selector}` });\n    }\n    if (text !== undefined) {\n      waits.push({ args: [\"wait\", \"--text\", text], condition: `text \"${text}\"` });\n    }\n    if (urlPattern !== undefined) {\n      waits.push({ args: [\"wait\", \"--url\", urlPattern], condition: `url ${urlPattern}` });\n    }\n    if (jsCondition !== undefined) {\n      waits.push({ args: [\"wait\", \"--fn\", jsCondition], condition: `js ${jsCondition}` });\n    }\n    if (timeMs !== undefined) {\n      // A fixed delay is its own duration; --timeout would override it.\n      waits.push({ args: [\"wait\", String(timeMs)], condition: `${timeMs}ms delay`, isDelay: true });\n    }\n    if (waits.length === 0) {\n      throw new Error(\n        \"Provide at least one of: selector, text, urlPattern, loadState, jsCondition, timeMs.\",\n      );\n    }\n    const cap = timeoutMs ?? 10_000;\n    const outcomes: WaitOutcome[] = [];\n    for (const wait of waits) {\n      const args = wait.isDelay ? wait.args : [...wait.args, \"--timeout\", String(cap)];\n      outcomes.push(await runWait(ctx, args, wait.condition));\n    }\n    return outcomes.length === 1 ? outcomes[0] : outcomes;\n  },\n});\n\nasync function runWait(\n  ctx: BrowserToolContext,\n  args: readonly string[],\n  condition: string,\n): Promise<WaitOutcome> {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/vercel-labs/agent-browser/blob/548b159b30eef119ccf6846c8bc807d0eaa3f6f8/packages/@agent-browser/eve/extension/tools/wait_for.ts#L56-L92","documentation":"The eve 'wait_for' tool builds a list of waits from six optional condition fields (selector, text, urlPattern, loadState, jsCondition, timeMs); timeoutMs is a modifier, not a condition. If every condition field is undefined the waits array is empty and execute() throws this message instead of running a pointless CLI call. Blank strings count as absent because optionalCondition preprocesses them to undefined.","triggerScenarios":"Calling wait_for with only timeoutMs; passing empty-string conditions (they are preprocessed away); models sending { } as a 'just wait' call without timeMs.","commonSituations":"Agent templates that always call wait_for after navigation; optional fields stripped by JSON round-trips; copy-pasted calls where the condition variable was empty.","solutions":["Add at least one condition, e.g. tools.waitFor({ selector: '#done' }) or tools.waitFor({ timeMs: 1000 })","For a plain delay use timeMs","If you only wanted the default page-load wait, skip the tool entirely — navigation already waits for load"],"exampleFix":"// before\nawait tools.waitFor({ timeoutMs: 5000 });\n\n// after\nawait tools.waitFor({ selector: \"#done\", timeoutMs: 5000 });","handlingStrategy":"validation","validationCode":"const hasCondition =\n  [input.selector, input.text, input.urlPattern, input.loadState, input.jsCondition, input.timeMs]\n    .some((v) => v !== undefined && v !== \"\");\nif (!hasCondition) {\n  throw new Error(\"wait_for needs at least one condition; use timeMs for a plain delay\");\n}","typeGuard":"function hasWaitCondition(i: Record<string, unknown>): boolean {\n  return [\"selector\", \"text\", \"urlPattern\", \"loadState\", \"jsCondition\", \"timeMs\"]\n    .some((key) => i[key] !== undefined);\n}","tryCatchPattern":null,"preventionTips":["Remember blank strings are treated as absent by the tool's preprocessor","Use timeMs for fixed delays and real conditions for everything else","Note navigation already waits for load — only wait for content that appears later"],"tags":["eve","input-validation","wait","synchronization"],"backgroundTag":null,"analyzedSha":"548b159b30eef119ccf6846c8bc807d0eaa3f6f8","analyzedAt":"2026-08-16T10:12:14.925Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}