garrytan/gstack · error · Error
Selector not found: ${opts.selector}
Error message
Selector not found: ${opts.selector} What it means
Error "Selector not found: ${opts.selector}" thrown in garrytan/gstack.
Source
Thrown at browse/src/snapshot.ts:154
* Take an accessibility snapshot and build the ref map.
*/
export async function handleSnapshot(
args: string[],
session: TabSession,
securityOpts?: { splitForScoped?: boolean },
): Promise<string> {
const opts = parseSnapshotArgs(args);
const page = session.getPage();
// Frame-aware target for accessibility tree
const target = session.getActiveFrameOrPage();
const inFrame = session.getFrame() !== null;
// Get accessibility tree via ariaSnapshot
let rootLocator: Locator;
if (opts.selector) {
rootLocator = target.locator(opts.selector);
const count = await rootLocator.count();
if (count === 0) throw new Error(`Selector not found: ${opts.selector}`);
} else {
rootLocator = target.locator('body');
}
const ariaText = await rootLocator.ariaSnapshot();
if (!ariaText || ariaText.trim().length === 0) {
session.setRefMap(new Map());
return '(no accessible elements found)';
}
// Parse the ariaSnapshot output
const lines = ariaText.split('\n');
const refMap = new Map<string, RefEntry>();
const output: string[] = [];
let refCounter = 1;
// Track role+name occurrences for nth() disambiguation
const roleNameCounts = new Map<string, number>();View on GitHub (pinned to 94993f7401)
When it happens
Trigger: Thrown at browse/src/snapshot.ts:154 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12).
Data as JSON: /api/errors/6f4f32cd04b29168.
Report an issue: GitHub.