vercel-labs/agent-browser · error

The "${property}" property requires a selector.

Error message

The "${property}" property requires a selector.

What it means

The eve 'get' tool splits properties into page properties (title, url — PAGE_PROPERTIES) and element properties (text, html, value, attr, count, box, styles). Element properties need a target, so execute() throws when the property is not in PAGE_PROPERTIES and selector is undefined, before any CLI call.

Source

Thrown at packages/@agent-browser/eve/extension/tools/get.ts:23

const PAGE_PROPERTIES = new Set(["title", "url"]);

export default defineTool({
  description:
    "Read a property of the page or an element: text content, innerHTML, input value, an attribute, the page title or URL, a match count, bounding box, or computed styles.",
  inputSchema: z.object({
    attribute: z.string().optional().describe('Attribute name, required when property is "attr".'),
    property: z.enum(["text", "html", "value", "attr", "title", "url", "count", "box", "styles"]),
    selector: z
      .string()
      .optional()
      .describe(`Required for element properties. ${SELECTOR_HINT}`),
  }),
  async execute({ attribute, property, selector }, ctx) {
    const args = ["get", property];
    if (!PAGE_PROPERTIES.has(property)) {
      if (selector === undefined) {
        throw new Error(`The "${property}" property requires a selector.`);
      }
      args.push(selector);
      if (property === "attr") {
        if (attribute === undefined) {
          throw new Error('The "attr" property requires an attribute name.');
        }
        args.push(attribute);
      }
    }
    return await runBrowser(ctx, args);
  },
});

View on GitHub (pinned to 548b159b30)

Solutions

  1. Add a selector, ideally a snapshot ref: tools.get({ property: 'text', selector: '@e5' })
  2. For page-level data use property 'title' or 'url', which need no selector
  3. Snapshot first and reuse refs instead of hand-written CSS

Example fix

// before
await tools.get({ property: "value" });

// after
await tools.get({ property: "value", selector: "#email" });
Defensive patterns

Strategy: validation

Validate before calling

const PAGE_PROPERTIES = new Set(["title", "url"]);
if (!PAGE_PROPERTIES.has(input.property) && input.selector === undefined) {
  throw new Error(`get ${input.property} needs a selector; snapshot first for a @ref.`);
}

Type guard

function needsSelector(property: string): boolean {
  return property !== "title" && property !== "url";
}

Prevention

When it happens

Trigger: Calling get with { property: 'text' } or { property: 'value' } without a selector; assuming get falls back to the page body; name confusion between 'title' (page-level) and element text.

Common situations: Models omitting the optional selector; reading input values or attributes without a ref from a prior snapshot; refactors that pass only the property.

Related errors


AI-assisted analysis of vercel-labs/agent-browser@548b159b30 (2026-08-16). Data as JSON: /api/errors/c7bc2471ccf484d4. Report an issue: GitHub.