calesthio/OpenMontage · error · RuntimeError

takes drawer not present on staged takes scene

Error message

takes drawer not present on staged takes scene

What it means

Raised by scripts/backlot_visual_eval.py's interaction smoke when, after opening the stage drawer and exercising the script-card modal (open, Escape, wait for close), the page has zero elements matching the .takes selector. The smoke expects the staged-takes scene to expose a takes list (.takes); absence means that component didn't render — either the scene genuinely has no takes data or the takes UI was removed/renamed in a refactor.

Source

Thrown at scripts/backlot_visual_eval.py:186

    from playwright.sync_api import sync_playwright

    screenshot = capture_dir / "interaction-smoke.png"
    with sync_playwright() as pw:
        browser = pw.chromium.launch(headless=True)
        page = browser.new_page(viewport={"width": 1560, "height": 1000})
        page.goto(f"http://127.0.0.1:{PORT}/p/the-last-lighthouse?static=1")
        page.wait_for_selector(".stage")
        page.locator(".stage").first.click()
        page.wait_for_selector(".drawer")
        drawer_text = page.locator(".drawer").inner_text()
        if "research" not in drawer_text:
            raise RuntimeError("stage drawer did not open")
        page.locator(".script-card").first.click()
        page.wait_for_selector(".modal-bg.open")
        page.keyboard.press("Escape")
        page.wait_for_function("() => !document.querySelector('.modal-bg')?.classList.contains('open')")
        if page.locator(".takes").count() < 1:
            raise RuntimeError("takes drawer not present on staged takes scene")
        replay_button = page.locator(".rp-btn", has_text="REPLAY RUN")
        if replay_button.count():
            replay_button.first.click()
            page.wait_for_selector('input[type="range"]')
            page.locator('input[type="range"]').fill("500")
        page.screenshot(path=str(screenshot), full_page=True)
        browser.close()
    return {"status": "passed", "screenshot": str(capture_dir / "interaction-smoke.png")}


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--bless", action="store_true", help="Write current captures as goldens")
    parser.add_argument("--no-stage", action="store_true", help="Reuse existing .backlot/screenshot-stage")
    parser.add_argument("--interactions", action="store_true", help="Run Playwright interaction smoke")
    parser.add_argument("--threshold", type=float, default=0.015)
    parser.add_argument("--out-dir", type=Path, default=None)
    args = parser.parse_args(argv)

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Manually load the page and confirm a takes list should be present for this scene; if the data is missing, fix the fixture.
  2. If the component was renamed, update the '.takes' selector in scripts/backlot_visual_eval.py to the current class.
  3. If takes render asynchronously, add a wait (e.g. page.wait_for_selector('.takes')) before the count check.

Example fix

# before
if page.locator(".takes").count() < 1:
    raise RuntimeError("takes drawer not present on staged takes scene")

# after
page.wait_for_selector(".takes", timeout=5000)
if page.locator(".takes").count() < 1:
    raise RuntimeError("takes drawer not present on staged takes scene")
Defensive patterns

Strategy: validation

Validate before calling

takes = page.locator(".takes")
if takes.count() < 1:
    # give lazily rendered content a chance before declaring failure
    try:
        page.wait_for_selector(".takes", timeout=3000)
    except PlaywrightTimeoutError:
        raise AssertionError(".takes selector absent — component renamed or takes data missing")

Try / catch

try:
    run_interaction_smoke()
except RuntimeError as e:
    if "takes drawer not present" in str(e):
        log.error(".takes missing — check the class name in the component and that the fixture has takes data")
    raise

Prevention

When it happens

Trigger: Running the visual eval on 'the-last-lighthouse' when the takes fixture data is missing/empty so the component renders nothing, or when a frontend refactor renamed the .takes class or restructured the takes drawer so the selector no longer matches.

Common situations: Fixture/seed data for the demo project missing takes; CSS class renamed during a component refactor; takes rendered lazily and not yet mounted when the count is checked.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/287af958dff9477c. Report an issue: GitHub.