crewship doctor
Runs a battery of checks against the local Crewship install and prints one row per check with a status. Designed for the “is everything OK before I file an issue?” workflow.Exit codes
WARN does not fail the command — you can wire
crewship doctor
into a healthcheck without false alarms on transient external state
(e.g. Sentry endpoint briefly unreachable). FAIL means a core
requirement for starting Crewship is missing or broken; treat the
non-zero exit as a hard gate.
Check categories
Server-dependent checks (server reachable, episodic recall mode, workbook editor proxy, cli server scheme) resolve the same effective server other commands dial:--server flag →
active profile (--profile / CREWSHIP_PROFILE) → CREWSHIP_SERVER env → config.
An active profile that has no server: entry fails closed — the scheme check reports
INFO instead of silently diagnosing a different host than your API calls use.
Database-dependent checks (db migration version, telemetry status, DSN
wiring, telemetry endpoint) read the SQLite file on this host, resolved
DATABASE_URL → CREWSHIP_DATA_DIR → ~/.crewship — the same order the server
itself resolves. The db migration version row prints that path and where it
came from, e.g. v20260826190607 (latest) — ./crewship.db (DATABASE_URL).
Until #2109 these checks
ignored
DATABASE_URL and always opened ~/.crewship/crewship.db. On any host
where crewshipd runs with its own DATABASE_URL — every development clone
uses file:./crewship.db — doctor reported on a file the instance had never
written, and nothing in the output said so.Unlike crewship admin / crewship db, these checks are not gated behind
--local and do not refuse when CREWSHIP_SERVER names a server. doctor
reports on the machine you run it on, by design; a diagnostic that switched
itself off because a server was named would be unavailable exactly when
something is wrong. Naming the file it read is what replaces the refusal.Container runtime
Detects which Docker-compatible runtime is available — Docker, Podman, Colima, OrbStack, Apple Containers, or Rancher Desktop. Auto-probes each candidate socket; the first reachable one wins.- PASS — runtime detected; agents can run.
- FAIL — no runtime found. Install one; see Install — container runtime requirement.
Container runtime gaps
The runtimes Crewship drives are not equivalent, and the differences are measured — a conformance harness runs the product’s own container config against a live daemon and records what each one silently declines to apply. This check reports what the runtime in use will not honour.- PASS — the runtime honours every crew hardening control.
- WARN — a control is dropped. The row names the control; the hint line
names the consequence. The only entry today is Podman below 5, which
reduces
GroupAddto the primary GID: agents never hold gid 1002, so every crew-shared memory read fails withEACCES. Upgrading to Podman 5+ is the only remedy — the GID cannot be delivered another way through the Docker compat API. - INFO — no Docker-API runtime answered (including Apple Containers, which is not one). The container runtime check above already owns that finding; this one does not repeat it.
Advisory by design. A gap is “this runtime has known limitations”, not
“your install is broken” — crews start, crews run, and every other control is
applied — so it never exits non-zero. The same finding is emitted as a startup
WARN in the server log and carried on
system info; a warning nobody can reach after boot
is why this check exists
(#1672).Pages apps
Reports whether Pages Apps are turned on for this crewship version: whether<CREWSHIP_PAGE_PROJECTS_PATH>/pages-build-image.json
records a compiler image for this binary’s build context fingerprint, and that
image still has the recorded ID, the exact tag crewship-pages-build:<prefix>
and the label. An image that only carries the label is not reported as enabled.
Pages Apps are optional, so a host that never enabled them is healthy. The check
reads the record and inspects one image; it never builds or starts a container.
- INFO —
not enabled (optional): nothing recorded. Runcrewship page enableto turn Pages Apps on. Also INFO when Docker is not reachable (the container runtime row owns that finding). - WARN —
not enabled: the recorded compiler image does not verify (…): the record names an image that is gone, retagged or relabelled, or the record file is unusable (not a regular file, writable by group or others). The server fails closed withpage_apps_not_enabled; runcrewship page enableas the server’s account. - WARN —
outdated: only images of other versions are recorded (the binary was upgraded). The server refuses builds withpage_apps_not_enableduntilcrewship page enablerecords the image for this version; the old one is kept for rollback. - WARN — enabled, but
page project storage is not configured(setCREWSHIP_PAGE_PROJECTS_PATHto an absolute directory outsidestorage.base_path) orno Page runtime origin(setCREWSHIP_PAGE_RUNTIME_ORIGINto a separate site; derived automatically only when Studio is served onhttp://localhost). Doctor reads these from the environment, not from a YAML server configuration. - PASS — enabled, with the short image ID and the effective runtime origin.
When
CREWSHIP_PAGE_BUILD_IMAGEis set the row names that explicit image instead, since the server uses it in preference to the labelled one.
Port binding
Confirms the HTTP port (default8080 or CREWSHIP_PORT) is free.
- PASS — port is bindable.
- FAIL — port in use.
lsof -i :8080to find the squatter, or changeCREWSHIP_PORT.
Database file permissions
Stats~/.crewship/ directory and the SQLite DB file. Expects:
- Parent directory:
0700 - DB file:
0600 - WAL + SHM sidecars (if present):
0600
tar without
preserving mode bits. Fix:
NEXTAUTH_SECRET
Surfaces where the JWT signing secret lives (env var vs<dataDir>/secrets.env) and validates the value is at least 32 characters. As of PR #446 the secret is auto-bootstrapped on first start, so a missing value is no longer a failure — doctor reports INFO and the next crewship start generates it.
Episodic recall mode
Reads theepisodic field from the running server’s /healthz.
Reports whether episodic memory recall runs
with a vector embedder or degraded to keyword/FTS only.
- PASS —
vector + sparse recall— an embedder is configured (KEEPER_OLLAMA_URL); the boot-time indexer sweeper is embedding journal entries and recall serves vector + BM25 results. - FAIL —
vector-degraded— an embedder is configured but its calls are failing, so the index is not growing and recall is silently BM25-only. The server includes the underlying error asepisodic_errorand this check prints it. The usual cause is an Ollama host that is reachable but not serving the model —ollama pull nomic-embed-texton that host. This is a FAIL rather than a WARN because it is worse thansparse-only: that one is a deliberate choice that still serves keyword recall, whereas this looks configured and delivers nothing. - WARN —
sparse-only— no embedder configured. Recall still works on keywords, but vector similarity is off. SetKEEPER_OLLAMA_URLto an Ollama host servingnomic-embed-text. - INFO — server not reachable / older server — the daemon is down
(the server reachable check already FAILs for that) or predates
the
episodichealth field.
Legacy crew resources
Calls the authenticatedGET /api/v1/admin/legacy-resources endpoint to detect
orphaned pre-C1 (slug-only) crew docker resources that survive
crewship seed --nuke and make every agent in the affected crew fail to start
— surfaced to users only as a generic “failed to start agent container”.
(Detection runs on this admin endpoint rather than the unauthenticated
/healthz path, so a slow docker daemon can’t stall health probes.)
- PASS —
clean— no orphaned legacy volumes/containers for any current crew slug. - WARN —
present— at least one orphaned pre-C1 resource exists. Agents in the affected crew(s) will fail to start. Runcrewship admin prune-legacyto remove them. - INFO — not logged in / unreachable / non-docker server — the check needs
an authenticated session (
crewship login); or the daemon is down (the server reachable check covers that) or the container provider isn’t docker.
Workbook editor proxy
For the embedded workbook editor in same-host mode (served under/_editor/
on the Studio origin, see
Same-host mode). Reads the coarse
workbook_editor state from the running server’s /healthz and, when you are
logged in as an instance administrator, the per-origin detail from
GET /api/v1/admin/instance/workbook-editor: the public Studio origins the
server checks (the configured one, or those signed-in browsers used) and the
result of its own check for each. It then requests /_editor/ variants
through the configured origin and the learned origins on the host --server
names (host and port), from this machine and without cookies: a plain
miss, a trailing slash, an unknown bundle, and the encoded traversals a
browser can send (..%2f, ..%5c). Run it from where a browser reaches
Crewship, so it goes through the same proxy, CDN or load balancer, with
--server set to the public Studio URL. Learned origins on other hosts are
listed, with the user who taught each, but not requested: any signed-in user
can make the server learn an origin, and doctor would otherwise send requests
from your machine to a host of their choosing. Check that they are yours, then
run doctor again with --server set to one of them.
- PASS — from this machine every variant reaches the editor with a policy for that origin and no redirect, no traversal reaches Crewship outside the editor (a refusal by the proxy is fine), and the server’s own check of the origin passed too.
- WARN — the check passes from here but the server’s own check has not
passed (
pending,unreachable, or failed without disabling the editor, for example a502while starting); no browser has used Studio since the server started, so no public origin is known yet (open Studio in a browser, then run doctor again); a public origin is not reachable from this machine; the server saw a browser origin whoseHostthe proxy rewrites; no origin the server checks is on the--serverhost; or a note such as the proxy setting cookies on/_editor/responses (harmless). Without an instance administrator’s login doctor knows only the coarse state:pendingandfailedare WARN,okis INFO. - FAIL — redirect or path rewrite — a variant is redirected (SSO gate,
trailing-slash rule) or Crewship answers a traversal outside the editor (the
proxy decodes or normalises the path). The path-scoped isolation does not
hold; fix the proxy so it passes
/_editor/unchanged. - FAIL — route marker removed — something in front of Crewship strips the
X-Crewship-Routeresponse header, so the check cannot tell whether a traversal reached Crewship outside the editor. The server disables the editor on that origin as well; pass the header through. - FAIL — does not work through the public URL —
/_editor/is not routed to Crewship, an authentication gate answers it, or the editor answers for another host (the proxy rewritesHost). The editor cannot load. - FAIL — the server disabled the workbook editor — the server’s self-check confirmed a redirect, a path rewrite or a removed route marker on an origin. The editor comes back by itself after three consecutive passing checks once the proxy is fixed; no restart is needed.
- INFO — the editor is off, uses a dedicated origin, the server is older or not reachable.
Telemetry status
Readsapp_settings.telemetry_opt_in from the local DB. Reports:
- PASS — ENABLED + DSN — telemetry is on and a DSN is wired in.
Shows the endpoint host (vendor default vs
CREWSHIP_SENTRY_DSNoverride). - PASS — DISABLED — operator opted out via
crewship telemetry off. - WARN — ENABLED but no DSN — consent recorded but no DSN available. Local dev builds without ldflag injection; not an error, just informational.
- WARN — not configured — fresh DB, never asked. Will default to
ENABLED on the next
crewship start(v0.1 beta behaviour).
DSN reachability
Only runs when telemetry is enabled AND a DSN is set. Best-effort TCP connect (5s timeout) to the resolved endpoint at port 443.- PASS — endpoint reachable; events will ship.
- WARN — endpoint unreachable. Crashes won’t ship until network
heals. Not a Crewship health signal — could be local firewall, DNS
issue, or Sentry outage.
crewship doctordoes not fail on this; you’d be silently angry at the wrong layer.
Update available
Calls the GitHub Releases API for the project (cached 24h locally).- PASS — running latest stable, or running a newer pre-release.
- WARN — newer stable available; output shows current → latest
with install hint (
brew upgrade crewshipordocker pull). - INFO — running a dev build, version check skipped.
CREWSHIP_SKIP_UPDATE_CHECK=1.
Example output
PR #441 added a version + OS/arch header banner and a “Next steps” footer that points the operator at the three commands that actually move them forward (or at the troubleshooting page on FAIL). Presentation-only — no check behaviour changes.Output formats
--no-color— disable ANSI colors. Auto-detected when stdout is not a TTY (so log-collection scripts get plain text without any flag).- Status codes (
PASS/WARN/FAIL/INFO) are always in left-padded brackets and parseable withawk '{print $1}'.
Auto-repair (--fix)
--fix opts into safe, narrowly-scoped repair side-effects during the
check run. Currently scoped to:
- Database directory missing — creates
$CREWSHIP_DATA_DIR(or~/.crewship) with0700perms instead of failing the check. The detail column then reads(created via --fix)so you can see what changed.
--fix is
for first-run onboarding, not running surgery on a populated install.
When to run
- Before opening a GitHub issue — attach
crewship doctor --no-coloroutput. Saves a back-and-forth diagnostic round. - After upgrading the binary — pre-migration snapshot has run by this point; doctor confirms the new binary is happy with the existing DB.
- In CI smoke tests — the
.github/workflows/smoke-test.ymlworkflow runscrewship doctoragainst the freshly-released binary on each release tag to catch broken binaries before they reach users.
Related
crewship start— the command doctor is checking for. If doctor is green,startshould succeed.crewship telemetry— flip consent state that doctor reports.crewship version— same version info doctor uses for the update-availability check.- Troubleshooting — symptom-keyed catalog of common failures.
crewship doctor cleanup
Read historical container cleanup diagnostics from the local SQLite database, including failures for a workspace that has been deleted. Local file permissions authorize this read; no server login or surviving workspace membership is needed. The command never contacts Docker, creates a database, applies migrations, or removes a resource.DATABASE_URL selects the local file, as with other doctor
probes. An old database without the diagnostic tables reports an error.
JSON contains
scope=containers, observation=persisted, and items with
installation/crew IDs, state, last observation, completeness, eligible remaining
count, legacy unattributed count and fixed error code. Observations older than
90 seconds read as stale unknown. Persisted snapshots are not live host
clearance and do not certify cleanup of volumes, host data or images.
crewship doctor execution-origins
Read a local database before or after upgrading to inventory execution-origin
fences. This command uses the same DATABASE_URL/local database resolution as
other doctor checks, opens SQLite read-only and never creates a database,
applies migrations, captures authority, retries work or changes permissions.
Local file access authorizes this diagnostic; it does not use a remote API.
The report lists bounded IDs, resource kinds, workspace IDs and machine-readable
reasons for active assignments, orchestration missions, pipeline runs, pending
pipeline runs and enabled recurring templates. It contains no titles, comment
bodies, credentials or requester receipts. Per-workspace/resource
candidates
counts cover all matching rows; inspected, blocked, needs_review and
receipt_current count only the inspected sample. truncated means additional
records were not inspected. missing_tables identifies older schemas.
blocked means a currently rejected receipt or agent execution from an enabled
recurring template without its required origin. Such a template can still create
issue records; the diagnostic does not claim that the entire schedule is paused. needs_review includes pre-migration provenance,
NULL origins whose autonomy cannot be inferred, and unavailable validation.
receipt_current means the original receipt passes its current read-only check;
executor and action-specific permissions are still unchecked. This inventory
is not an exact deployment-impact prediction or approval to deploy. Re-admission
requires the existing authorized workflow; this command cannot perform it.