# Diagnostics & Error Reference

When something goes wrong, Swarmfile names the problem in one of a few places. This page maps the surfaces - doctor checks, status counters, health endpoints, and error codes - to plain meanings and next steps.

## Start here

| Surface | What it is | How to reach it |
|---|---|---|
| **Desktop App → Settings → Diagnostics** | Live checks, report file, **Repair drive**, **Reinstall…**, update check | The tray's settings |
| **Status pill** (header) | Mount location, sync state, the hub's reason for any pause | Click it |
| **`swarmfile status`** | The same snapshot as JSON or prose: counters, peers, bandwidth | CLI |
| **`swarmfile-doctor`** | Standalone probe suite that runs with no engine and no sign-in; engine-only checks are reported as a pass carrying `skipped (requires the engine)` when no engine is running | CLI |
| **`swarmfile doctor`** | Runs the same probes through a live engine | CLI |
| **Hub error codes** | Machine-readable reasons on API refusals (bring-your-own scripts) | JSON bodies |

`swarmfile-doctor` returns a verdict, and writes its JSON report to a file when you pass `--report <path>`:

```bash
swarmfile-doctor --json --report doctor-report.json   # full detail
sudo swarmfile-doctor --repair --yes                   # reinstall the desktop app (keeps your queue)
```

Exit codes: **`0`** everything passed, **`1`** at least one failure, **`2`** warnings only. No report file is written without `--report`.

There is one `swarmfile-doctor`. It ships on `PATH` with every desktop install and, for machines without the desktop app (a hub or a self-hosted community server checked from a server or a build agent), as a standalone download (`curl -fsSL https://get.swarmfile.com/doctor | sh`); its source is open, in the `swarmfile-doctor` public repository (built on `swarmfile-lib`).

On its own it runs the engine-free checks; when a `swarmfile-engine` is running it finds it through `control.json` and asks it over the local control socket for the engine/OS-only checks above (real, against the engine's own hub, cloud or community). With no engine running those appear as `pass` + "skipped (requires the engine)".

It takes the headless inputs `--token` / `--org-id` / `--repository-id` / `--timeout`. `--repair` reinstalls the desktop app from the update channel it was installed from, after verifying the download, and refuses on a machine without the desktop app; see [`swarmfile-doctor --repair`](https://swarmfile.com/docs/cli/swarmfile-doctor#--repair) and [Diagnosing Connectivity](https://swarmfile.com/docs/guides/connectivity-doctor).

Engine logs live in the cache directory (`~/.cache/swarmfile` on macOS and Linux, `%LOCALAPPDATA%\swarmfile` on Windows) as `engine.log`; the Desktop App writes `tray.log` beside it, and macOS mount-helper output lands in `~/Library/Logs/fuse-t/fuse-t.log`. Diagnostics has an **Open log directory** action. Increase detail with `RUST_LOG=swarmfile_engine=debug`.

## Status counters

`swarmfile status` (and the Desktop App's panels) report these; the names are the JSON fields from `swarmfile status --json`:

| Counter | Meaning | What to do |
|---|---|---|
| `pendingUploads` | Blocks queued on this machine awaiting cloud upload, plus closed files whose save is still running | Wait; check for connection trouble |
| `peerPendingUploads` | In-flight uploads reported by other machines on this branch | Usually informational |
| `pendingCreates` | Files/folders created locally and queued for the hub (an object with the count, stuck rows at six or more failed attempts, and the oldest age) | They land automatically; see [Coding Agents](https://swarmfile.com/docs/guides/coding-agents#4-create-bursts-and-the-pending-create-queue) |
| `createsReconciled` | Creates whose response was lost and whose registry row the engine then adopted by re-listing - the "dialog said the create failed but the repository exists" case, recovered | Informational; non-zero is for support (`swarmfile status --json`) |
| `commitsPending` | Bytes uploaded but the commit hasn't landed (retrying, rate-limited, quota-held, or locked) | Check `quotaHeldCommits` and connectivity |
| `quotaHeldCommits` | Commits refused on billing grounds, retried on a 15-minute cadence; `spendCapHeldCommits` is the subset held by the org's spend cap, which the tray names ("Waiting on spend cap") | Raise the limit or free space; retries resume |
| `commitsRefused` | Commits the hub keeps refusing for other reasons (a subset of `commitsPending`) | Investigate the refusal; usually policy or conflict |
| `deferredOps` | Deferred rename/delete queue: ops applied locally and still owed to the hub (`queued`), how many are `held` (parked on a lock, a closed branch scope, or a child move still settling), the oldest op's age, and lifetime `confirmed`/`rolledBack` counts | Informational; `held` is the one to check - it makes no progress until the holder changes. See [Working with Files](https://swarmfile.com/docs/guides/working-with-files) |
| `abandonedGroups` | Upload groups that exhausted retries or hit a plan cap | `swarmfile sync stuck` lists them; re-save after fixing the cause |
| `failedWrites` | Guest-session writes permanently given up (guest replay only) | Re-open the guest session and retry |
| `conflicts` | Files blocked by an unresolved conflict. A blocked write reaches an application as a plain I/O error, so `status` counts it here instead of staying silent; on a repository (or drive) in **hard conflict mode** the losing save fails immediately instead of blocking the file | Run `swarmfile conflicts` to list the paths and resolve |
| `activeLocks` | Write locks this engine currently holds | Informational |
| `checkoutLocks` | Long-lived per-file checkout locks (explicit, git-LFS) you hold | Release with `unlock` / `offline return` when done |
| `scopeReservations` | Offline scope reservations this engine holds - one row can cover a whole subtree; Pack & Go uses these rather than per-file locks | `swarmfile offline status` |
| `checkoutRenewFailures` | Renewal passes that re-issued nothing - reservations at risk of lapsing | Reconnect and re-prepare before the lease ends |
| `checkoutExpiringSoon` | Reservations expiring within 24 hours | Extend or return; see [Working Offline](https://swarmfile.com/docs/guides/offline-working) |
| `peers` | LAN/office/seed peers currently reachable, with RTT | More peers = faster reads for shared files |
| `bandwidth.bytesIn` / `bandwidth.bytesOut` | Transfer volume for this session | Useful when a link is saturated |
| `blockStore` | Pinned blocks and local cache usage | `swarmfile cache status` / `hydrate status` |
| `auth` | Session state ("signed out" when there's no usable session) | Sign in again |
| `recentErrors` | A ring of the most recent engine errors | Often the fastest pointer to the root cause |
| `lastSequenceId` | Latest committed sequence known here | Diagnostic for history lag |
| `mounted` / `mountState` / `mountError` | Whether the mount is live and, if not, why (a stable code plus a user-facing sentence) | See the mount errors below |

## Health endpoints

There is **no default health port** - the server starts only when `SWARMFILE_HEALTH_PORT` is set (typical choices: `8080` in container deployments, `9100` for a seed node). It binds `0.0.0.0:<port>` and serves exactly:

- `GET /livez` - a cheap `{"status":"ok"}` for liveness probes (Kubernetes and friends). Allowed from anywhere.
- `GET /healthz` - the detailed snapshot (version, uptime, peer counts and RTT, pin/cache stats, encryption state). **Loopback-only**: a non-loopback caller gets `403 {"error":"loopback only"}`, because the detail exposes operational internals.
- Anything else - `404`.

## Doctor checks

`swarmfile-doctor` reports one row per check. The whole report is capped at 10 seconds; if the cap fires, a synthetic `report` check fails, and a probe that couldn't complete counts as a failure rather than a silent pass. Each of the three network checks - `hub https /health`, `oidc token`, `cloud path` - retries one fast transient failure (a connection error or a 5xx) before it reports Fail, so a brief hub blip doesn't read as an outage; a definitive refusal like an expired token's `401` is reported on the first reply. The ones that name a common failure:

| Check | Failing usually means |
|---|---|
| `engine-running` | No engine for this user; sign in / start the app, or expect the standalone checks below |
| `install-layout` | The engine isn't where the installer put it (moved out of the app bundle, or an older macOS install whose LaunchAgent still runs a stale copy); reinstall or use **Repair**. On macOS it also warns when `/usr/local/bin` is missing the CLI-tool links (a `.dmg`-only install the tray couldn't repair), since `swarmfile` is then not on `PATH`. |
| `updater-helper-task` | The elevated Windows updater helper is missing or mis-registered; reinstall (Windows) |
| `dns <host>` | DNS resolution for the hub/identity/storage host failed |
| `hub https /health` | The hub host is unreachable or blocked; proxy/firewall issue |
| `hub deep health` | The hub is up but one of its dependencies (its database, storage, the identity provider, or its own clock) is degraded |
| `oidc token` | The sign-in session expired, was revoked, or the account isn't a member of the configured org; sign in again |
| `cloud path` | Cloud storage credentials, presigning, or the block path failed for this org |
| `iroh quic dial` / `mdns listen` | Peer-to-peer connection or local-network peer discovery blocked (firewall, VLAN, VPN); falls back to the hub |
| `host firewall` / `macos local network` | OS firewall or macOS Local Network consent blocks LAN discovery |
| `uploads in flight` / `in-flight streaming` | Uploads or reads waiting on in-flight bytes exist - expected during activity, informative otherwise |
| `fuse-t mount helper` / `mount` | The macOS mount helper died, the mount point is wedged or absent, or a killed session left a stuck mount attempt behind. For an **attached** mount, try **Repair drive** first; a stuck attempt that survives the repair needs a restart of the computer. For a mount that **never attached** (e.g. all helper slots held), **Repair drive** cannot cycle it - free a slot and use the boot gate's **Try again** / `swarmfile mounts retry`; a failed runtime `mounts open` must be re-opened. |
| `duplicate mount stack` | Two engines are competing for the same mount point |
| `exclusive writes` | Never fails - informational: names the drives in the opt-in [exclusive-write mode](https://swarmfile.com/docs/guides/multiple-mounts#keeping-two-agents-off-the-same-file) |
| `history retention` | Never fails - informational: the active repository's retention mode (every saved version kept and cold-archived, or named commits only). "Not checked" without a repository scope |
| `upload quota` | Blocks are parked because the org is at a billing limit - see the count/bytes/age in the row |
| `plan` | Subscription inactive, a feature isn't in the plan (e.g. seed mode), or a metered dimension is ≥80% |
| `pack and go policy` | A `SWARMFILE_PACK_AND_GO_POLICY` value that isn't `allowed`/`disabled` - failing closed |
| `previous run` | The last engine run ended abnormally (panic or unexpected exit) - the row points at `engine.log` |
| `url scheme` | `swarmfile://` links (Open in app, sign-in, Explorer's Swarmfile menu) won't reach this install: no app is registered for the scheme, another app or install owns it, or (macOS) several copies of Swarmfile compete for it and a link may start an old one. **Fix link handling** re-registers this install; on Windows, a registration pointing at another install needs **Repair** from Settings › Apps |

The standalone `swarmfile-doctor` asks a running engine for engine-only checks. With no engine it reports those as a **pass carrying `skipped (requires the engine)`** - treat that as not checked, not as a successful mount/portal probe.

## Engine and mount errors (what the app shows)

| Code / message | Meaning | Fix |
|---|---|---|
| `not_signed_in` | The engine has no usable session | Sign in from the app |
| `not_a_member` | The session doesn't include the configured org/repository | Switch organization or ask for an invite |
| `repository_deleted` | The mounted repository was permanently deleted | Mount another repository; contact support about recovery within retention |
| `config_parse_error` | A `config.json` couldn't be read, so the engine came up without a repository | The message names the file and the parse position - fix it and restart; see [Engine Config File](https://swarmfile.com/docs/reference/config-file) |
| `mount_failed` / `no_free_drive_letter` | Windows could not attach the mount | Free a drive letter or choose one in the app; `swarmfile mounts open auto` |
| `fuse_t_helper_ports_exhausted` | All 18 fixed FUSE-T helper ports are held - by this engine's own drives, a leaked helper, another Swarmfile engine, another app, or a non-FUSE-T process | Close a drive or quit the app holding one, then use the boot gate's **Try again** / `swarmfile mounts retry`; restart Swarmfile only if that route is unavailable. For a non-helper process, quit that process or restart the computer. `swarmfile doctor` names the holders it can identify; **Repair drive** cannot cycle a mount that never attached |
| `fuse_t_helper_port_probe_failed` | The engine could not probe FUSE-T's helper ports (resource pressure or a socket error), so the range may be free | Free resources, then use **Try again** / `swarmfile mounts retry` for the boot mount (or re-open a failed runtime mount); restart Swarmfile if it persists. This is not a "close another drive" problem |
| `drive_letter_in_use` | The chosen letter (or Auto's candidates) are all taken | The message names what holds it; pick another |
| `mount_point_not_empty` | Windows refuses to mount over a non-empty folder | Choose an empty folder |
| `pack_and_go_disabled` | An administrator disabled bulk offline reservation | Use a per-file lock or ask your admin |
| `access_lease_expired` | The organization's [offline access window](https://swarmfile.com/docs/guides/offline-working#the-organizations-offline-access-window) elapsed - this computer hasn't reached Swarmfile within it, so local files are paused | Reconnect to the network; the drive resumes on its own (a restart won't help) |
| `confirmation_required` | A destructive CLI command was run without `--yes` in a non-interactive context | Re-run with `-y` after checking what it will delete |
| `usage_error` | A CLI invocation didn't parse (unknown command, flag, or argument); emitted as JSON when `--json` is present, with clap's `kind` | Fix the invocation - see [Scripting against the CLI](https://swarmfile.com/docs/cli/swarmfile#scripting-against-the-cli) |
| `changelist_open` | A branch/repository switch was refused because staged work is open | Submit, cancel, or `--park` first |
| `cross_repository_mount_open` | An org switch was refused because an open drive points at a different repository - that drive can't follow the engine to another org | Close that drive (the Desktop App names it in the switch confirm), then switch |
| `changelists_open` | `swarmfile mounts close` was refused because the mount has open changelists | Submit or cancel them, or pass `--force` |
| `is_default_mount` | You tried to close the boot mount on its own | Close another mount, or quit the engine instead |
| `shared_branch_context` | The mount shares the engine's branch context | Re-open it with `mounts open --branch <name>` to make it independently switchable |
| `already_running` / `repository_switch_running` | Another switch or long job of that kind is in flight | Wait for it to finish, then retry |
| `pending_create` | A lock/comment/share on a file that is still being created | Retry after it syncs (`swarmfile status` → `pendingCreates`) |
| `account_switch_requires_restart` | A runtime sign-in for a **different account** was refused | Restart the app (the tray offers the restart); the requested sign-in is kept and the restart completes the switch - the local cache identity is reconciled at boot, and the previous account's unsent work is quarantined, not lost |
| `account_switch_park_failed` | The requested account switch couldn't be saved for the restart (e.g. the disk is full) | Your current session is unaffected - free up disk space and try signing in again |

## Hub error codes (for scripts and integrations)

API refusals carry a machine-readable `code`. The ones most worth handling, in the order you'll meet them:

| Code | Meaning | Typical handling |
|---|---|---|
| `bad_request`, `invalid_request`, `invalid_state`, `invalid_name`, `bad_cid`, `invalid_cid`, `bad_hash` | Malformed or out-of-order request | Fix the request; don't retry blindly |
| `credential_invalid`, `email_verification_required`, `email_not_verified`, `session_expired`, `session_revoked`, `unauthenticated`, `terms_acceptance_required` | Auth/session problem | Sign in again; verify email for share actions; accept updated terms |
| `api_key_*` (`api_key_grant`, `api_key_org_mismatch`, `api_key_repository_mismatch`, `api_key_scope_forbidden`) | API-key scope doesn't cover this operation | Use a key scoped to the repository/org, or mint a new one |
| `forbidden`, `not_member`, `admin_role_required`, `idp_binding_rejected` | Not permitted for this account/role | Escalate to an admin |
| `root_create_restricted` | Creating or moving an entry directly at the root of a protected repository, by a caller who isn't the repository creator and holds no repository-wide `write` grant (a folder-scoped grant, even `admin`, doesn't qualify) | Create inside an existing folder, or ask an owner or the repository creator; a held create-queue save resumes once access changes, and a `git push` that would add a root name is refused the same way - its error names the remedy (move the files inside a folder, or gain repository-wide write) |
| `org_mfa_required`, `org_email_verification_required` | The org's [authentication policy](https://swarmfile.com/docs/admin/identity#authentication-policy-require-mfa-andor-a-verified-email) refuses this credential | Enroll an authenticator app / verify your email under Account settings, then sign in again - the refusal body's `enrollUrl` points there. Don't retry unchanged; a personal access token must be re-minted from a compliant session |
| `owner_mfa_required`, `mfa_status_unavailable` | Turning on "require MFA" needs the acting owner's own confirmed factor (or the factor-status probe was unreachable) | Enroll an authenticator app first, then retry the policy change |
| `identity_conflict` | An external-IdP sign-in conflicts with an existing Swarmfile account: its subject names a first-party user, or a principal provisioned by a different issuer | Contact the organization's administrator; sign in through the org's own SSO rather than a built-in Swarmfile account |
| `entry_not_found`, `entry_deleted`, `repository_not_found`, `repository_deleted`, `path_not_found`, `not_a_file`, `source_gone`, `target_gone` | The target is gone | Re-list; treat as terminal |
| `exists`, `name_conflict`, `id_conflict`, `name_taken` | Collision or illegal name | Rename / resolve the conflict |
| `entry_uploading` | The entry has no committed version yet | Wait for upload, then retry |
| `unscoped_repository_route` | The client called an org URL that needs `/repositories/:id` - an out-of-date desktop app does this | Update Swarmfile; the desktop app holds the affected save and reports it once instead of retrying |
| `stream_retired` | The notification/activity stream isn't supported; clients poll instead | Poll `GET /orgs/:orgId/notifications` (and `/activity`); don't reconnect the stream |
| `stage_discarded` | A `POST /jobs/:id/retry` was refused because the job's staged operation was already discarded | Start the operation again - there is nothing left to retry |
| `not_cancellable` | `POST /jobs/:id/cancel` (and `swarmfile op cancel`) refused: this operation can't stop part-way - a commit, merge or delete completes or fails on its own | Let it finish; follow it with `op wait` |
| `too_late` | `POST /jobs/:id/cancel` refused: the staged revert/checkout has already begun applying (including the moment after it published), so there is no unpublished stage to discard | Nothing to stop - the commit lands; the operation ends with its real outcome (`op status` / `op wait`), not `canceled` |
| `chunk_missing`, `cid_mismatch`, `checksum_mismatch`, `size_mismatch`, `manifest_unreadable`, `manifest_too_large`, `tree_object_corrupt`, `tree_object_missing`, `commit_object_corrupt`, `commit_object_missing` | Content integrity/structure problem | Re-upload the file; report if persistent |
| `conflict_detected`, `conflict_unresolved`, `merge_conflict`, `stale_merge` | Concurrent edits, or the target moved since the merge/conflict was prepared. With conflict mode **hard**, this surfaces at the saving call itself as a stale-version error (`ESTALE`; on Windows, "the volume for a file has been externally altered") | Re-read the file and retry; resolve the conflict (`swarmfile conflicts resolve`) when one was recorded |
| *(no `code`; the envelope's `error` text says `target_changed` / `merge_candidate_changed`)* | The file changed again after the conflict was recorded, or the automatic merge result changed after you previewed it | Re-read the file and resolve against the newer version; run the merge attempt again before accepting. Match the text, not a `code` - the hub sends these two without one |
| `locked` | Someone else holds the file, or a machine's Pack & Go scope reservation covers it | Wait, or request an unlock (`swarmfile unlock-request`); a scope reservation is released by its owner with `swarmfile offline return` |
| `commit_mode_locked`, `policy_enforced` | An admin lock requires a different commit mode, or refuses the setting | Check the enforced mode with `swarmfile config get-commit-mode`, then use it |
| `commit_race`, `head_changed`, `merge_in_progress`, `fork_in_progress` | History moved under you, or a merge/fork is running | Re-read, wait, then retry; when a repository job holds the same operation, the refusal names that job - retry or cancel it first |
| `branch_not_found`, `branch_mismatch`, `branch_locked`, `branch_has_open_mr`, `branch_has_active_children`, `merge_main` | Branch rules prevented the action | Use the allowed path (merge the MR, delete children first, never merge into main directly) |
| `not_approved`, `self_review`, `is_draft`, `not_draft`, `protected_branch` | Merge-request gates | Get approvals, un-draft, don't self-review |
| `source_changed` | The merge request's source branch changed after you opened it, so your review would cover changes you haven't seen | Reload the merge request and review it again |
| `repository_archived`, `storage_exceeded`, `quota_exceeded`, `spend_cap_reached`, `plan_restricted`, `keys_cap`, `subscription_inactive`, `too_many_entries`, `too_many_descendants`, `registry_too_large`, `batch_too_large`, `body_too_large`, `merge_too_large`, `too_many_cids` | Plan or size limit | Free space, upgrade, or split the request/repository; `merge_too_large` means the merge exceeded the single-repository merge capacity - land the branch in smaller pieces - otherwise retry after the allowance changes. `spend_cap_reached` is the dollar ceiling: the envelope carries `capCents`/`usedCents`/`remainingCents` (and `keyLimitCents`/`keyId` when a per-key budget was the binding wall) - raise the cap or free space and held writes resume on their own |
| `repository_storage_full` | This **repository** hit its metadata ceiling (files and versions combined) | Delete or purge files, delete stale branches, shorten history retention, or switch the repository to **Named commits only** (the same guidance the owner notification carries) - see [Repository storage limit](https://swarmfile.com/docs/admin/operations#repository-storage-limit) |
| `checkout_required` | The org hasn't completed subscription checkout | Finish checkout in Billing before creating repositories |
| `rate_limited` | Request budget exceeded | Back off and retry; see [Rate limits](https://swarmfile.com/docs/admin/organizations-repositories-and-members#who-can-see-plan-and-usage-standing) |
| `grace_period_inaccessible` | The org is in the post-unpaid 28-day window | Resubscribe - see [Data Portability](https://swarmfile.com/docs/admin/data-portability-and-offboarding) |
| `quarantined` | Ransomware detection quarantined the account; writes stop until an owner releases it (on Windows the drive stays mounted meanwhile, with saves held locally) | Review and release from the quarantine panel - see [Ransomware quarantine](https://swarmfile.com/docs/admin/operations#ransomware-quarantine) |
| `repository_key_unavailable`, `repository_key_rotation_unsupported` | Encryption key unavailable, or the repository can't rotate (plaintext storage, or it has reached the maximum key generations) | Check the repository's encryption tier; contact support if the cap is reached |
| `stale_generation`, `incomplete_recipients`, `unexpected_recipients`, `key_rotation_cap_reached` | E2E key rotation conflicts: another device rotated first; the caller's wrap set was missing (or named non-) current recipients; or the 64-generation cap was reached | Re-run the rotation (the engine re-fetches the recipient set and retries once automatically); an owner should confirm the device roster before rotating |
| `e2e_upload_unsupported`, `e2e_unsupported`, `e2e_not_supported`, `encryption_tier_not_public` | The operation isn't allowed for this tier | Use the supported tier (e.g. LFS is rejected on E2E) |
| `jurisdiction_incompatible` | The destination isn't in the pinned jurisdiction - the org's, or a repository's own | Use storage/a destination in the pinned region |
| `residency_unavailable`, `residency_storage_unavailable`, `jurisdiction_unverifiable`, `residency_unverifiable` | A per-repository residency pin was refused: this deployment can't route one, the region's storage isn't ready yet, or the check couldn't be completed just now | Retry shortly (a region still provisioning becomes ready on its own); if it persists, contact support |
| `share_too_large`, `block_not_in_share`, `block_session_expired`, `raw_byte_budget_exceeded` | Share-link limits or a public-streaming budget | Reduce scope, create a new share, or wait out the budget |
| `too_many_webhooks`, `blocked_target`, `invalid_url` | Webhook limits or an unsafe target URL | Delete unused webhooks; use a public HTTPS endpoint |
| `preview_budget_exhausted`, `preview_too_large`, `preview_type_unsupported` | Preview generation budget, size, or type limit | Wait for the daily reset; serve the file directly or download it |
| `too_many_active_jobs`, `too_many_concurrent_reads` | Temporary concurrency limit | Back off and retry |
| `do_write_budget_exceeded` | The repository's writes are paused for the rest of the UTC day after it wrote several times its daily budget; starting a background job, a merge or a `git push` is refused (saves, reads and deletes still work) | Retry after the body's `retryAtMs` or the `Retry-After` header; an org owner or admin can release the pause once a day. See [Write pause](https://swarmfile.com/docs/admin/operations#write-pause) |
| `write_budget_release_used`, `write_budget_not_tripped` | A write-pause release was refused: today's release for this repository is already used, or nothing is paused | After the daily release, only Swarmfile support can release the repository; otherwise nothing to do |
| `fork_index_building` | The hub is still building its index of the files this branch inherited | Temporary: retry after `retryAfterSeconds` / `Retry-After`; the Desktop App retries a commit on its own |
| `fork_too_large` | The branch inherited more files than the hub can index, so commits and pushes on it can't land | Final for that branch: work on the default branch or ask the repository owner. See [Branches & Merging](https://swarmfile.com/docs/guides/branches-and-merging#how-this-holds-up-on-a-very-large-repository) |
| `ci_not_available`, `ci_disabled`, `ci_branch_unprotected`, `ci_e2e_unsupported` | Hosted CI is refused for this org, repository or branch: a repository owner hasn't enabled it, the branch isn't protected and unprotected runs aren't opted in, a hosted job targets an end-to-end encrypted repository (a hosted runner holds no E2E key), or a self-hosted E2E run has no plaintext sidecar or no live granted runner | Enable it as an owner (`swarmfile ci enable`); protect the branch, or opt in with `--allow-unprotected`; for E2E use a [self-hosted runner](https://swarmfile.com/docs/guides/self-hosted-ci) |
| `self_hosted_runners_not_enabled`, `self_hosted_runners_unavailable` | Self-hosted CI is disabled for this organization, or the organization's policy could not be read | An owner can enable or disable it under **Settings → Hosted CI → Policy**; a policy-read failure is transient, so retry the run - see [Self-Hosted CI Runners](https://swarmfile.com/docs/guides/self-hosted-ci) |
| `ci_e2e_no_workflow`, `ci_e2e_hosted_unsupported`, `ci_e2e_tree_file_unsupported` | Self-hosted E2E CI is refused: the repository has no plaintext workflow sidecar, a hosted-size job is declared in an E2E workflow, or the sidecar uses a local action/reusable workflow (their sources are encrypted tree files) | Save a self-contained workflow in the CI tab; run E2E jobs on a `runs-on: [self-hosted, ...]` job; keep the sidecar self-contained - see [Self-Hosted CI Runners](https://swarmfile.com/docs/guides/self-hosted-ci) |
| `ci_workflow_invalid`, `ci_yaml_invalid`, `ci_expression_invalid`, `ci_jobs_too_many`, `ci_secret_undeclared` | `.swarmfile/ci.yml` didn't compile (the error carries the line), the expansion passed 256 jobs, or a job referenced a secret it didn't declare | Fix the workflow; declare every secret a job reads in its `secrets:` list - see [Hosted CI](https://swarmfile.com/docs/guides/hosted-ci) |
| `ci_fork_disabled`, `fork_ci_approval_required`, `ci_fork_mr_not_open`, `ci_fork_event_refused`, `ci_fork_unsupported`, `ci_fork_refused` | Contribution (fork) CI is refused: the server has not enabled it, the exact source head has no live approval (or the approval expired), the MR is not open, a schedule or plain push targets a contribution branch, the workflow exceeds the read-only profile, or a claim asked for writes | Enable it as an operator (`CI_FORK_RUNS`); approve the exact head on the MR (`swarmfile ci fork-approve`); push a new head and approve it; run the workflow from the merge request only - see [Contribution CI](https://swarmfile.com/docs/guides/hosted-ci#contribution-fork-ci) |
| `fork_has_local_changes`, `fork_open_changeset`, `fork_upstream_mismatch`, `fork_source_branch_missing`, `fork_source_empty`, `fork_too_large`, `fork_sync_not_a_fork` | A fork sync is refused: the fork has local commits or an open changeset, its upstream changed or the recorded branch is gone/empty, the source is too large, or the repository is not a fork | Merge or discard local work, submit or close the changeset, restore the upstream branch (or re-fork), then sync again |
| `ci_self_hosted_protected_commits_not_enabled` | A self-hosted `mount: write` job is refused because the organization has not opted into self-hosted protected commits | An organization owner enables **Hosted CI → policy → Self-hosted protected commits**; the server must also enable writable mounts and the runner must understand the mount spec - see [Writable workspaces](https://swarmfile.com/docs/guides/self-hosted-ci#writable-workspaces) |
| `invite_unavailable`, `org_not_empty`, `installation_exists`, `already_provisioning`, `storage_provisioning` | Admin lifecycle state | Complete or wait for the pending operation |
| `announce_unverified` | A seed node's announce failed node authentication | Re-enroll the node; see [Self-Hosted Seed Nodes](https://swarmfile.com/docs/admin/self-hosted-seed-nodes) |
| `org_migration_frozen`, `repository_unreachable`, `async_unavailable` | A migration/maintenance state | Retry after it completes |
| `not_supported_on_this_server`, `server_profile_too_old` | Returned by the desktop app's engine (and so the CLI) against a [self-hosted community server](https://swarmfile.com/docs/guides/self-hosting#what-the-community-server-leaves-to-the-hosted-service): the server doesn't offer this feature, or it is older than this app needs. The CLI adds a `hint:` line (a `hint` field under `--json`) for the first | Use the hosted service for that feature; for a new repository, ask the server's administrator to create it (`swarmfile-server admin create-repository`); upgrade the server for `server_profile_too_old` |
| `not_found`, `forbidden` | Generic - the meaning depends on the operation | Use your caller's contextual fallback; don't guess |

The full set is generated from the hub's own routes and shipped in the hub's published API schema and OpenAPI contract; an unrecognized code is preserved verbatim rather than dropped, so a script can always log it.

## Exit codes

| Binary | Codes |
|---|---|
| `swarmfile` | `0` success; `1` failure (unreachable engine, transport error, no product equivalent); `2` actionable refusal **or a usage error** - under `--json` the two are distinguishable by `code` (`usage_error` vs the refusal's code); `3` a long operation is still running (returned by `--no-wait`, or after Ctrl-C detaches the command) - follow it with `swarmfile op status` / `op wait`; see [Scripting against the CLI](https://swarmfile.com/docs/cli/swarmfile#scripting-against-the-cli) |
| `swarmfile-doctor` | `0` all passed; `1` ≥1 failure; `2` warnings only. With `--repair`: `0` reinstalled, `1` a step failed, `3` refused or canceled with nothing changed. A usage error under `--json` prints the shared `{"code":"usage_error",…}` body, as every standalone tool does |
| `swarmfile-runner` | The engine's code (the alias re-execs it); `127` if the sibling engine is missing |
| `swarmfile-migrate`, `swarmfile-search`, `swarmfile-seed`, `swarmfile-mirror` | `0` success; `1` failure (a failed verification or upload, an unreachable hub, a refused destination collision); `2` a malformed invocation - the shared `{"code":"usage_error",…}` body under `--json` |
| `swarmfile-verify-history` | `0` the loaded history verified; `1` verification found tampering or a gap; `2` the check couldn't run (bad arguments, unreachable hub, auth error) - see [the CLI reference](https://swarmfile.com/docs/cli/swarmfile-verify-history) |
| `swarmfile-engine lfs-transfer` | Not a scripted CLI: git-LFS spawns it for one operation and reads its protocol replies. It exits `1` only when it can't start |
| `git-remote-swarmfile` | Not a scripted CLI: git spawns it for `git clone` / `git push` over a `swarmfile://` remote. A failure prints its reason (and writes `git-remote-last-error.log`) and exits non-zero - see [the CLI reference](https://swarmfile.com/docs/cli/git-remote-swarmfile) |

## Where to go next

- [Troubleshooting](https://swarmfile.com/docs/guides/troubleshooting) - symptom-first workflows.
- [Network Requirements](https://swarmfile.com/docs/reference/network-requirements) - the hosts and ports the checks probe.
- [Environment Variable Index](https://swarmfile.com/docs/reference/environment-variables) - `SWARMFILE_HEALTH_PORT`, `RUST_LOG`, and the diagnostic switches.
