Browse docs
Docs / CLI Reference / swarmfile-doctor
View as Markdown

swarmfile-doctor

On this page

swarmfile-doctor diagnoses Swarmfile connectivity: DNS, hub, cloud storage, the peer-to-peer network, mDNS, and OIDC, plus install-layout (detects an install an update can't reach) and a plan check.

When an engine is running, the plan check reads your organization's plan standing and fails when Swarmfile isn't signed in, because a machine that can't read your plan generally can't reach your files either; without an engine it reports pass with "skipped (requires the engine)". On seed/NAS nodes it additionally verifies your plan includes the seeding entitlement. Signed in as a guest reviewer, it passes and says so: guests aren't members, so there's no plan to read.

It is ONE tool that works with or without a running engine: on its own it runs the engine-free probes (DNS, the hub's /health, the block path, OIDC, the server's profile descriptor, and its signed host identity when served); when a swarmfile-engine is running it discovers it (its cache-dir control.json) and fetches the engine/OS-only checks (the mount, the peer-to-peer swarm and local-network peer discovery, transfer stats, the firewall, the engine socket) over the local control socket, against whatever hub the engine is configured for (the hosted cloud or a community server).

Use it on a machine where the engine isn't up, won't start, or you're not sure which is true.

It ships on PATH with the .pkg/.deb/MSI installs and is also published as a standalone download for machines where installing the app isn't an option: Developer ID-signed and notarized on macOS, Authenticode-signed on Windows (SmartScreen reputation may still warn), and unsigned on Linux; see Getting Started and Security.

Flags#

FlagDescription
--jsonMachine-readable output
-q, --quietSuppress non-error output. Implies --json for stdout.
--report <path>Also write the JSON report to this file. No report file is written without it. With --repair, the report holds one repair check with the outcome.
--hub-url <url>Override the hub URL to check. Without it, $SWARMFILE_HUB_URL is used, and with neither, a running engine supplies its own hub.
--org-id <org>Organization id (with --repository-id, enables the block-path probe).
--repository-id <id>Repository id (with --org-id, enables the block-path probe).
--token <key>Bearer token (sf_key_… / sf_pat_…). Defaults to $SWARMFILE_API_KEY.
--timeout <secs>Per-request timeout (default 10).
--no-irohSkip the peer-to-peer connectivity probe
--no-mdnsSkip the mDNS discovery probe
--latencyAlso time the hub routes a push/download walks (/health, the org's repository list, the repository's branches and changesets) three times each and report min/avg/max. The hub latency check warns above 500 ms on any route; the repository-service routes are expected to be slower than /health.
--iroh-peer <HOST:PORT>Accepted for compatibility and unused: the running engine's own peer-to-peer check runs instead
--cache-dir <path>Engine cache dir. Default ~/.cache/swarmfile (macOS/Linux), %LOCALAPPDATA%\swarmfile (Windows).
-v, --verboseVerbose output
--repairReinstall the Swarmfile desktop app from its update channel, after verifying the download. See --repair.
--yesSkip the confirmation prompt for --repair (required when there is no terminal to ask on)
--allow-downgradeWith --repair, install the update channel's version even when it is older than the installed one (macOS and Linux).

Host identity#

The host identity check fetches /.well-known/swarmfile.json from the checked hub and verifies the statement's shape, its canonical origin (the configured public origin, not the request Host), its key/signature format and its freshness.

A 404/503 is a pass: the statement is optional and a community or self-hosted deployment without a public origin is healthy.

A malformed body, a different origin, or a stale/future issuedAt is a failure. Shape is all this check proves; use swarmfile-verify-history --check-host-identity for the signature and active-key binding (see Verifiable History).

Hub latency#

--latency (and the Desktop App's Run doctor, which includes it) answers the "why is my push slow?" question with numbers instead of a guess. It times four routes three times each:

  • /health - the edge the request lands on;
  • GET /orgs/<org>/repositories - the organization's own control-plane service;
  • GET .../repositories/<id>/branches - the repository service (the push preflight);
  • GET .../repositories/<id>/changesets?limit=1 - the repository service's commit log.

The check's detail lists each route as avg ms (min, max) with the HTTP status when it is not 2xx (a repository key may be refused the org list, for example), and the check warns when any route's worst sample exceeds 500 ms or a route cannot be reached. A healthy health with a slow branches/changesets points at that repository's service (or its region), not the network; a slow health too points at the path to the edge. For route-level detail use the hosting platform's request log for the repository and the same time window.

Exit codes#

The process exit code is the machine-readable verdict, so a script or provisioning step can gate on it without parsing the report:

CodeMeaning
0Every check passed.
1At least one check failed.
2At least one warn, and no fails.

With --repair the codes mean:

  • 0 the desktop app was reinstalled (or upgraded; the result line says which)
  • 1 a step failed (reading the update channel, the download, the verification, or the installer itself)
  • 3 refused or canceled with nothing changed (no desktop install, an unsupported platform or update channel, an older version without --allow-downgrade, no confirmation, not running as root, the Windows administrator prompt declined, a Windows session that is neither elevated nor signed in to a desktop, more than one installed Windows product named exactly "Swarmfile", or a self-hosted install, which updates only from its bundle)

--repair#

--repair reinstalls the Swarmfile desktop app on this machine from the update channel it was installed from. It is the command-line form of Diagnostics → Reinstall… in the Desktop App: use it when the app is too broken to open, or from a remote shell or a management tool. Your files, settings and upload queue stay in place.

  1. It finds the desktop install from the configuration file the installer wrote, which also names the install's update channel.

    The swarmfile-doctor that ships inside an install repairs that install; a separately downloaded copy repairs the standard install (/Applications/Swarmfile.app, %ProgramFiles%\Swarmfile, or the swarmfile package on Linux). With no desktop install it refuses (exit 3) and points you at swarmfile.com/downloads.

    It also refuses (exit 3) on the self-hosted edition: that install is pinned to the bundle it came from, and reinstalling from an update channel would replace it with the hosted app.

  2. It checks the update channel. Only Swarmfile's own update channels are accepted, and only the one that matches the install, so a reinstall can never move an install to a different Swarmfile environment.

  3. It picks the full installer for this machine from the update channel: the .pkg on macOS, the .msi for the machine's architecture on Windows, the amd64 .deb on Debian, Ubuntu and their derivatives (where the swarmfile package is installed with dpkg).

    Other Linux distributions and non-amd64 Linux aren't supported by --repair; reinstall the package with your package manager.

    If the swarmfile package is installed but its configuration file (/etc/swarmfile/config.json) is missing, --repair can't tell which update channel the install came from: it refuses and says so, and installing the .deb from Downloads with sudo apt-get install ./swarmfile_<version>_amd64.deb restores the file.

  4. It won't move you backwards. If the channel publishes an older version than the one installed, it refuses; --allow-downgrade installs it anyway on macOS and Linux. Windows never installs an older version over a newer one: uninstall first.

  5. It shows the plan and asks. It prints the installed version, the version it will install, the download, how the download is verified and the installer command (with the exact path of the file it will run), then asks for confirmation. --yes skips the question; with no terminal to ask on (a script or a management tool), --repair needs --yes.

  6. It verifies before anything runs. The download is over HTTPS and stays on the channel's own servers. The .msi and .deb must match the release signature published in the update channel, checked with that channel's own release key (the same check automatic updates apply), and the signature must be for that exact file. The .pkg must match its published SHA-256, carry Swarmfile's own Developer ID Installer signature, and pass Gatekeeper as notarized. A download that fails any check is never run.

  7. It runs the installer and reports the result: installer -pkg … -target / on macOS; on Windows msiexec /i … REINSTALL=ALL REINSTALLMODE=vamus when the channel has the installed version (a full in-place reinstall, with the verified .msi saved under the file name Windows recorded for the install, such as Swarmfile.msi for a Setup.exe install, which an in-place reinstall requires) or msiexec /i … for a newer one, with /norestart REBOOT=ReallySuppress (it never restarts the machine; if a restart is needed to finish, it says so).

    It shows a progress bar (/qb) in a signed-in desktop session and runs fully silently (/qn) without one, such as SYSTEM from a management tool or an elevated remote shell.

    The verified .msi is saved in a new folder only its owner, SYSTEM and administrators can open (in the install folder for an elevated run, otherwise your temp folder), and the installer's verbose log (msiexec.log) goes in the same folder; after a failure the folder stays with the log and the result names its path.

    If Windows has more than one installed product named exactly "Swarmfile" (an old install left beside the current one), an in-place reinstall can't tell which to use: it refuses (exit 3) and asks you to uninstall the extra one in Settings > Apps. dpkg -i … on Linux. If dpkg reports missing dependencies, sudo apt-get -f install finishes the install.

Administrator rights#

The installer needs administrator rights. On macOS and Linux, run it as root (sudo swarmfile-doctor --repair); otherwise it shows the plan and stops.

Because it then decides what to install as root, it refuses when the installed app's configuration isn't owned by root or is writable by other users. A .pkg or .deb install is root-owned; an app copied from the .dmg belongs to the user who copied it, so on that machine download the .pkg from Downloads and run it instead (or make the app root-owned first, sudo chown -R root:wheel /Applications/Swarmfile.app). On Linux the refusal names the fix for the configuration file and its folder (sudo chown root:root /etc/swarmfile /etc/swarmfile/config.json, then chmod 755 the folder and chmod 644 the file).

On Windows, run it from an administrator prompt or approve the Windows prompt (an administrator on a machine with UAC turned off counts as elevated); a run that is neither elevated nor in a signed-in desktop session (a scheduled task or a remote shell as a standard user) refuses with exit 3, because no one could approve the prompt.

See Operations for where a reinstall fits into a broader recovery workflow.

--repair prints its plan and result as text: --json and --quiet don't apply to it. Use --report <path> for a machine-readable result.

Examples#

Plain diagnostic run:

swarmfile-doctor

JSON output suitable for attaching to a support ticket:

swarmfile-doctor --json --report doctor-report.json

Reinstall the desktop app without a prompt (macOS or Linux):

sudo swarmfile-doctor --repair --yes

Something wrong or missing? Report a docs issue.