{"record":{"id":"bae56f1b03ebf8f0","repo":"can1357/oh-my-pi","slug":"unsupported-selector-prefix-use-css-or-puppeteer","errorCode":null,"errorMessage":"Unsupported selector prefix. Use CSS or puppeteer query handlers (aria/, text/, xpath/, pierce/). Got: ${selector}","messagePattern":"Unsupported selector prefix\\. Use CSS or puppeteer query handlers \\(aria/, text/, xpath/, pierce/\\)\\. Got: (.+?)","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/browser/tab-worker.ts","lineNumber":290,"sourceCode":"\t}): Promise<HTTPResponse | null>;\n\tid(n: number): Promise<ActionableHandle>;\n\tref(id: string): Promise<ActionableHandle>;\n}\n\nexport function normalizeSelector(selector: string): string {\n\tassertSelectorString(selector);\n\tif (!selector) return selector;\n\tif (\n\t\t!SELECTOR_HANDLER_PREFIXES.some(prefix => selector.startsWith(prefix)) &&\n\t\tPLAYWRIGHT_ONLY_SELECTOR_RE.test(selector)\n\t) {\n\t\tthrow new ToolError(\n\t\t\t`Playwright-only selector ${JSON.stringify(selector)} is not supported by the browser tool. ` +\n\t\t\t\t`Use a puppeteer text selector (\"text/Allow all\"), an aria selector (\"aria/Name\"), CSS, or \"xpath/...\".`,\n\t\t);\n\t}\n\tif (selector.startsWith(\"p-\") && !LEGACY_SELECTOR_PREFIXES.some(prefix => selector.startsWith(prefix))) {\n\t\tthrow new ToolError(\n\t\t\t`Unsupported selector prefix. Use CSS or puppeteer query handlers (aria/, text/, xpath/, pierce/). Got: ${selector}`,\n\t\t);\n\t}\n\tif (selector.startsWith(\"p-text/\")) return `text/${selector.slice(\"p-text/\".length)}`;\n\tif (selector.startsWith(\"p-xpath/\")) return `xpath/${selector.slice(\"p-xpath/\".length)}`;\n\tif (selector.startsWith(\"p-pierce/\")) return `pierce/${selector.slice(\"p-pierce/\".length)}`;\n\tif (selector.startsWith(\"p-aria/\")) {\n\t\tconst rest = selector.slice(\"p-aria/\".length);\n\t\tconst nameMatch = rest.match(/\\[\\s*name\\s*=\\s*(?:\"([^\"]+)\"|'([^']+)'|([^\\]]+))\\s*\\]/);\n\t\tconst name = nameMatch?.[1] ?? nameMatch?.[2] ?? nameMatch?.[3];\n\t\tif (name) return `aria/${name.trim()}`;\n\t\treturn `aria/${rest}`;\n\t}\n\treturn selector;\n}\n\nfunction isInteractiveNode(node: SerializedAXNode): boolean {\n\tif (INTERACTIVE_AX_ROLES.has(node.role)) return true;","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/browser/tab-worker.ts#L272-L308","documentation":"normalizeSelector rejects selectors starting with the legacy `p-` prefix unless they match a recognized legacy form. These `p-` handlers were the old puppeteer-style prefixes; unrecognized `p-...` selectors are refused with a pointer to the supported handlers (aria/, text/, xpath/, pierce/) or plain CSS.","triggerScenarios":"Passing selectors like `p-role/button`, `p-css=...`, or any `p-`-prefixed string that is not one of the migrated legacy forms (`p-text/`, `p-xpath/`, `p-pierce/`, etc.).","commonSituations":"Older prompts/scripts/agent traces that used the deprecated `p-` selector dialect; mixed-up prefixes like `p-aria/` after the migration renamed them to bare `aria/`.","solutions":["Drop the `p-` prefix: `p-aria/Name` → `aria/Name`, `p-text/...` → `text/...`.","For text/xpath/pierce the legacy `p-` forms are auto-rewritten — use the bare form directly to avoid relying on the alias.","Use plain CSS when no handler is needed.","Update stored prompts/playbooks that still emit `p-` selectors."],"exampleFix":"// before\ntab.click(\"p-text/Allow all\");\n// after\ntab.click(\"text/Allow all\");","handlingStrategy":"validation","validationCode":"if (selector.startsWith(\"p-\")) {\n  selector = selector.replace(/^p-(text|xpath|pierce)\\//, \"$1/\"); // migrate legacy prefix\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Drop the legacy p- prefix everywhere; use bare handler prefixes (aria/, text/, xpath/, pierce/)","Search old scripts for 'p-' selectors and migrate them","Rely on CSS for selectors that need no query handler"],"tags":["selector","puppeteer","browser-tool","deprecation"],"backgroundTag":"unsupported-selector-syntax","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}