Skip to content

Hyphenated --chromeArg values dropped during daemon serialization and lazy subcommand startup #2406

Closed

Description

@gvojta

Description of the bug

When executing CLI subcommands with custom Chromium startup options (such as --use-fake-device-for-media-stream or --use-file-for-fake-audio-capture=...), two independent bugs previously prevented flags from reaching puppeteer.launch:

  1. Yargs Value Collision: serializeArgs emitted options and values as detached token pairs (['--chrome-arg', '--use-fake-device...']). When initializing the spawned daemon process, yargs interpreted the hyphenated trailing token as an unrelated command option, stripping the value from --chrome-arg.
  2. Lazy Startup Parameter Dropping: When invoking action subcommands against an inactive session, auto-start initialization called start([], sessionId). This hardcoded empty array silently discarded all browser configuration flags passed on the invocation command line.

Reproduction

  1. Attempt to pass synthetic media flags via chrome-devtools start:

    /google/bin/releases/chrome-devtools/chrome-devtools start \
      --sessionId=repro_audio \
      --chromeArg="--use-fake-device-for-media-stream" \
      --chromeArg="--use-file-for-fake-audio-capture=/tmp/test-audio.wav"
  2. Trigger a page navigation so the daemon launches Chromium:

    /google/bin/releases/chrome-devtools/chrome-devtools navigate_page \
      --sessionId=repro_audio \
      --url="about:blank"
  3. Inspect the underlying /opt/google/chrome/chrome process:

    ps -ef -ww | grep "/opt/google/chrome/chrome" | grep -v grep

Observed Behavior

  • Neither --use-fake-device-for-media-stream nor --use-file-for-fake-audio-capture=/tmp/test-audio.wav appears on the /opt/google/chrome/chrome process command line.

  • Root Cause 1: serializeArgs(options, argv) formats array items as separate tokens (['--chrome-arg', '--use-fake-device...']). Because the value starts with --, yargs in the daemon process interprets --use-fake-device... as an unknown command option and drops --chrome-arg.

  • Root Cause 2: When invoking action subcommands against an inactive session, lazy auto-start calls start([], sessionId) with an empty array, dropping any startup configuration flags passed on the command line.

Expectation

Chromium launches with all requested --chromeArg flags included.

MCP configuration

No response

Chrome DevTools MCP version

1.6.0

Chrome version

No response

Coding agent version

No response

Model version

No response

Chat log

No response

Node version

No response

Operating system

None

Extra checklist

  • I want to provide a PR to fix this bug

Activity

  1. added theissue type on Jul 23, 2026
  2. gvojta commented on Jul 23, 2026

    @gvojta
    ContributorAuthor

    PR: #2405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions