vercel-labs/agent-browser · error

The "attr" property requires an attribute name.

Error message

The "attr" property requires an attribute name.

What it means

Within the eve 'get' tool, property 'attr' reads a single attribute, so after the selector check it also requires the attribute name. execute() throws when property is 'attr' and attribute is undefined — the CLI syntax is 'get attr <selector> <attribute>' and there is nothing sensible to send without the name.

Source

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

    "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. Name the attribute: tools.get({ property: 'attr', selector: '#link', attribute: 'href' })
  2. For element identity/structure use property 'html' instead when you want everything
  3. Validate the attr/attribute pair in your caller before invoking

Example fix

// before
await tools.get({ property: "attr", selector: "#link" });

// after
await tools.get({ property: "attr", selector: "#link", attribute: "href" });
Defensive patterns

Strategy: validation

Validate before calling

if (input.property === "attr") {
  if (input.attribute === undefined) throw new Error("attr requires attribute name");
  if (input.selector === undefined) throw new Error("attr requires selector");
}

Type guard

function isAttrRequestValid(i: { property: string; attribute?: string }): boolean {
  return i.property !== "attr" || typeof i.attribute === "string";
}

Prevention

When it happens

Trigger: Calling get with { property: 'attr', selector: '#link' } while forgetting attribute; assuming attr returns all attributes as a map.

Common situations: Models treating attribute as optional metadata; porting code from tools that return full attribute dictionaries.

Related errors


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