Skip to main content
Use doctor to find out why a dev session (or an automation verb talking to it) is not working. doctor walks the control-channel legs of a dev session in dependency order (from the on-disk readiness contract all the way to a live probe of the in-extension executor) and names the first failing leg with a concrete fix, instead of the dead-end error each command gives on its own.

When to use doctor

  • extension logs or an act verb can’t connect and you want to know which leg is broken.
  • An agent or script drives a session via ready.json and needs a machine-readable health check.
  • A dev session looks alive but the extension stopped responding.

Usage

If you omit the path, Extension.js diagnoses the session for the current working folder.

Arguments and flags

How doctor picks the session

Without --browser, doctor diagnoses the session that exists, not a hardcoded default. It lists the ready contracts under dist/extension-js/ and resolves from there:
  • Exactly one live contract wins outright.
  • With several contracts, chromium wins when present, otherwise the first one alphabetically. A session-resolution warn check then names every candidate before the numbered checks run.
  • With no contracts at all, doctor falls back to chromium.

What it checks

Checks run in dependency order. When a leg fails, later checks that depend on it are marked skip and name the check that blocked them: a skip is not a pass. A zeroth session-resolution check appears only when several live sessions exist. It warns and names the session that the run diagnoses. Some legs have deliberate soft answers:
  • port-agreement passes when no port file exists yet. A first session for this project and browser has nothing to disagree with.
  • executor reports warn, not fail, within 10 seconds of a fresh compile. The service worker may still be attaching. Wait for runtime: "attached" in ready.json before acting.
  • browser reports skip when the contract has no cdpPort stamped and no exit recorded. Absence of exit evidence is not proof of a live browser.
The pretty output prints one line per check plus the first failing check’s remediation. Each status has a glyph: ✓ pass, ✗ fail, ! warn, – skip. The exit code is 0 when nothing failed and 1 when any check failed, so CI and scripts can gate on it directly.

Machine-readable output

--output json prints one schema-1 envelope. The check results ride in value on both verdicts, because an unhealthy report is still a report:
A healthy run answers ok: true with status: "healthy" and error: null. status on each check is pass, fail, warn, or skip. remediation is present on failures that have a known fix. The envelope’s error.code maps from the first failing check:

Typical flow

  1. Start a session: extension dev --browser=chromium --allow-control (add --allow-eval for the eval verb).
  2. When a follow-up command can’t reach it, run extension doctor from the same project root.
  3. Apply the remediation printed for the first failing check, then re-run doctor to confirm.

Next steps

  • Read the readiness contract doctor starts from in dev.
  • Stream extension logs from a healthy session with Debugging.
  • Review shared flags in Global flags.