Skip to content

Intermittent NullPointerException ('no details from runtime') on reload/get with --auto-connect multi-tab CDP session #109

Description

@WZHKAWF

Summary

Intermittent unexpected browser error (NullPointerException, no details from runtime) (error_code: unknown_error) from reload and get * commands when running against a long-lived --auto-connect (Mode 3) CDP session with many tabs. The session stays otherwise healthy (session reports CDP connected, correct title/URL), and the same command succeeds on retry — often immediately after a --debug invocation.

Environment

  • spel 0.9.5
  • Bundled Playwright runtime: 1.58.0, mac-arm64
  • OS: macOS (darwin, Apple Silicon)
  • Browser: Microsoft Edge, external CDP endpoint ws://127.0.0.1:9222/... (attached via --auto-connect, Mode 3)
  • Session: 17 tabs, 307 cookies, headless=yes, persist=yes

Symptom

$ spel --session <s> --auto-connect reload
Hint: An unexpected browser error occurred. Retry once with --debug; ...

$ spel --session <s> --auto-connect --json get url
{"error":"unexpected browser error (NullPointerException, no details from runtime)",
 "error_code":"unknown_error"}

After the failed reload, subsequent get url / get text / get title all fail with the same NPE until a retry (a --debug run reliably recovered it). session continued to work throughout and reported CDP connected: yes.

Impact

Transient but disruptive for agent/scripted flows: a single flaky reload cascades into failures on following commands until a manual retry.

Reproducibility

Intermittent — could not reproduce deterministically afterward (plain reload + get url later worked fine). Appears to be a race in re-selecting the active page/context right after a reload on a multi-tab CDP-attached session.

Notes / asks

  • The wrapped error swallows the underlying stack: NullPointerException, no details from runtime. The daemon log (/tmp/spel-<session>.log) only contains the CDP connect line — no stack captured. Surfacing the underlying Playwright/CDP stack trace (or at least which internal call returned null — likely the active Page ref) would make this diagnosable.
  • Possibly the active-page handle becomes null mid-reload and isn't re-resolved before the next command; a guard/auto-reattach + retry on null page could fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions