garrytan/gstack · error · Error

Element not found: ${sel}

Error message

Element not found: ${sel}

What it means

Error "Element not found: ${sel}" thrown in garrytan/gstack.

Source

Thrown at browse/src/cdp-inspector.ts:576

            range,
            text: newPropsText,
          }],
        });
        method = 'setStyleTexts';
        source = `${targetRule.source}:${targetRule.sourceLine}`;
        sourceLine = targetRule.sourceLine;
      } catch (err: any) {
        // Fall back to inline — setStyleTexts fails on immutable stylesheets or stale ranges
        if (!err?.message?.includes('style') && !err?.message?.includes('range') && !err?.message?.includes('closed') && !err?.message?.includes('Target')) throw err;
      }
    }

    if (method === 'inline') {
      // Fallback: modify via inline style
      await page.evaluate(
        ([sel, prop, val]) => {
          const el = document.querySelector(sel);
          if (!el) throw new Error(`Element not found: ${sel}`);
          (el as HTMLElement).style.setProperty(prop, val);
        },
        [selector, property, value]
      );
    }
  } catch (err: any) {
    // Full fallback: use page.evaluate for headless
    await page.evaluate(
      ([sel, prop, val]) => {
        const el = document.querySelector(sel);
        if (!el) throw new Error(`Element not found: ${sel}`);
        (el as HTMLElement).style.setProperty(prop, val);
      },
      [selector, property, value]
    );
  }

  const modification: StyleModification = {

View on GitHub (pinned to 94993f7401)

When it happens

Trigger: Thrown at browse/src/cdp-inspector.ts:576 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/26ff0a016924a390. Report an issue: GitHub.