`list_console_messages` misses messages logged before the server attached

Open
#2,382 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@yiaany is already working on this.

Since Aug 28, 2026.

  • #2383 by @thomasbachem — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
devtools

Research direction

Start at the list_console_messages implementation and trace how page.on('console') is subscribed during connection. Reproduce with --browserUrl, then use page.createCDPSession() and Runtime.enable to compare buffered replay with live collection; done means pre-attach messages appear without duplicates while new messages continue to appear.

Written by the indexing model from the issue text.

Description

confirmed
Description of the bug

list_console_messages only reports messages emitted after the server attached. Attach to an already-loaded page (e.g. --browserUrl against a browser that's been running a while) and it returns <no console messages found> even though the page logged plenty during load – all sitting right there in a DevTools window.

It's a quiet failure – an empty listing reads as "the page logged nothing", and it cost me a bogus diagnosis before I spotted it.

The messages aren't lost. Chromium buffers them and replays them via Runtime.consoleAPICalled to every new CDP session that calls Runtime.enable. Puppeteer calls Runtime.enable itself during connect(), so the replay is emitted on the page before any consumer can subscribe – page.on('console') never sees it.

PR: #2383.

Reproduction
  1. Start Chrome with --remote-debugging-port, and have a page log something (console.log('PRE-ATTACH'))
  2. Start chrome-devtools-mcp with --browserUrl against it
  3. list_console_messages -> <no console messages found>
  4. Log something new -> only that one shows up

A fresh raw CDP session on the same page replays what step 3 missed, so the buffer is intact. It's also reachable from the server's own page object:

const session = await page.createCDPSession();
session.on('Runtime.consoleAPICalled', ...);
await session.send('Runtime.enable'); // replays the whole buffer

That recovered every buffered message in my test, and page.on('console') kept working afterwards.

Expectation

list_console_messages includes what the page logged before the server attached – or failing that, says the listing only starts at attach, so an empty result isn't mistaken for a clean page.

A backfill would double up on anything the live collector already holds, so it presumably wants dedup, or to run before the collector subscribes. Happy to send a PR if you have a preference on which.

Chrome DevTools MCP version

1.6.0 (on main too)

Dominant language
TypeScript
Stars
59.8k
Forks
4.8k
Avg merge
2d 10h
Merged PRs (30d)
162

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ChromeDevTools/chrome-devtools-mcp

All issues in ChromeDevTools/chrome-devtools-mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.