{"record":{"id":"c7bc2471ccf484d4","repo":"vercel-labs/agent-browser","slug":"the-property-property-requires-a-selector","errorCode":null,"errorMessage":"The \"${property}\" property requires a selector.","messagePattern":"The \"(.+?)\" property requires a selector\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@agent-browser/eve/extension/tools/get.ts","lineNumber":23,"sourceCode":"\nconst PAGE_PROPERTIES = new Set([\"title\", \"url\"]);\n\nexport default defineTool({\n  description:\n    \"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.\",\n  inputSchema: z.object({\n    attribute: z.string().optional().describe('Attribute name, required when property is \"attr\".'),\n    property: z.enum([\"text\", \"html\", \"value\", \"attr\", \"title\", \"url\", \"count\", \"box\", \"styles\"]),\n    selector: z\n      .string()\n      .optional()\n      .describe(`Required for element properties. ${SELECTOR_HINT}`),\n  }),\n  async execute({ attribute, property, selector }, ctx) {\n    const args = [\"get\", property];\n    if (!PAGE_PROPERTIES.has(property)) {\n      if (selector === undefined) {\n        throw new Error(`The \"${property}\" property requires a selector.`);\n      }\n      args.push(selector);\n      if (property === \"attr\") {\n        if (attribute === undefined) {\n          throw new Error('The \"attr\" property requires an attribute name.');\n        }\n        args.push(attribute);\n      }\n    }\n    return await runBrowser(ctx, args);\n  },\n});\n","sourceCodeStart":5,"sourceCodeEnd":36,"githubUrl":"https://github.com/vercel-labs/agent-browser/blob/548b159b30eef119ccf6846c8bc807d0eaa3f6f8/packages/@agent-browser/eve/extension/tools/get.ts#L5-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"Models omitting the optional selector; reading input values or attributes without a ref from a prior snapshot; refactors that pass only the property.","solutions":["Add a selector, ideally a snapshot ref: tools.get({ property: 'text', selector: '@e5' })","For page-level data use property 'title' or 'url', which need no selector","Snapshot first and reuse refs instead of hand-written CSS"],"exampleFix":"// before\nawait tools.get({ property: \"value\" });\n\n// after\nawait tools.get({ property: \"value\", selector: \"#email\" });","handlingStrategy":"validation","validationCode":"const PAGE_PROPERTIES = new Set([\"title\", \"url\"]);\nif (!PAGE_PROPERTIES.has(input.property) && input.selector === undefined) {\n  throw new Error(`get ${input.property} needs a selector; snapshot first for a @ref.`);\n}","typeGuard":"function needsSelector(property: string): boolean {\n  return property !== \"title\" && property !== \"url\";\n}","tryCatchPattern":null,"preventionTips":["Snapshot first and pass @refs instead of hand-written selectors","Use property 'title'/'url' for page-level reads — they need no selector","Wrap the tool with a discriminated-union type (property + selector) so invalid combos are compile-time errors"],"tags":["eve","input-validation","get-tool","selector"],"backgroundTag":null,"analyzedSha":"548b159b30eef119ccf6846c8bc807d0eaa3f6f8","analyzedAt":"2026-08-16T10:12:14.925Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}