Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

13. Troubleshooting

← Contents

Start with these three; between them they explain most problems:

mailcoded health          # store, secret backend, gates, per-account state
mailcoded account test    # does the credential still work? IMAP and SMTP, separately
mailcoded stats           # counters, the outbox, sends left this hour

In the TUI, S shows the same on one screen, including each account’s last error, and A runs the connection test.

Messages, and what to do about them

Getting started

You seeIt meansDo
No account is configured. Run 'mailcoded setup' first.the store has no accountschapter 2
'setup' is interactive and needs a terminal.setup was run from a script, or with redirected inputuse account add --password-stdin
'mailcoded-tui' was not found beside this binary or on PATH.the TUI binary is not installed next to the CLIscripts/install.sh, or run mailcoded-tui from the build output directly (chapter 1)
The TUI needs a terminal; stdin or stdout is redirected.mailcoded tui inside a piperun it in a terminal; scripts use the one-shot verbs
This console cannot render ANSI. Try Windows Terminal. (exit 2)the legacy Windows consoleuse Windows Terminal

Signing in

You seeIt meansDo
a login failure from setup, with hintswrong host or port, or the provider wants an app passwordread the hints; most providers reject the account password over IMAP (chapter 2)
Microsoft did not return a sign-in code within 45s. Check the network, then try again.the device-code request did not completecheck connectivity to login.microsoftonline.com; try again
the Microsoft consent page names another applicationmailcoded borrows a public client registrationexpected; use --client-id with your own registration if you prefer (chapter 2)
account test reports IMAP ok but SMTP authyou can read; the SMTP server rejected the credentialsending fails until it accepts; reading is unaffected. For Microsoft accounts this is a known open issue at the time of writing
The new credential was stored but the server still refuses it: ...reauth stored it; the server said nothe reason follows; exit 7 is authentication, 8 is network

Syncing

You seeIt meansDo
sync: Timed out connecting to <host>:<port>.nothing answered at that addressa wrong host, a firewall, or the import-only account (chapter 10)
This account has no stored credential, so it cannot sync. ...the account was registered without a credential, or is the local import accountmailcoded account reauth --account <id>, or leave it
Live updates belong to another mailcoded window; press r to refresh here.another daemon owns this store’s live connectionsnormal with two TUI windows; r refreshes (chapter 9)
Another live daemon (pid N) owns this store; watch connections stay closed here. (stderr)the same, from the daemon’s side
any other red sync: ...the server refused, or failedA or account test for the detail; S for the last error
Still <something>. Press esc to give up on it.a server operation is slowwait, or esc to cancel it
The daemon is gone: ..., TUI exits 3the daemon process diedthe TUI prints the daemon’s recent stderr as it exits; run it again; mailcoded-tui --check

Reading

You seeIt means
(body not fetched) in the readerthe body could not be downloaded just now
(this message has no plaintext part)it is HTML-only; there is no HTML view
in a subject or bodythe message contained control or invisible characters (chapter 12)
matches were dropped that no cursor reachesa search hit the paging ceiling; narrow it, or order by date

Sending

You seeIt meansDo
Sending from the agent surface requires MAILCODED_SEND=1. (exit 4)the CLI send gate is closedchapter 7 — or send from the TUI, which is not gated this way
exit 6, confirm-requiredno valid token: missing, spent, expired, or the draft changedsend-preview again
That confirmation is spent or expired. Preview again. (TUI)the samectrl-s again
exit 5, rate-limitedfive sends this hour alreadywait retry_after_ms
a recipient refusednot on MAILCODED_APPROVED_RECIPIENTSadd it, or send from the TUI
outbox shows failed with an SMTP replythe server rejected the messagethe reply says why

Moving and removing

You seeIt meansDo
Moving mail is outside the default agent posture. ...move or archive from a script, without MAILCODED_ALLOW_MOVE=1 and --yesset the variable; add --yes for an unattended run
Moving mail is not part of the agent surface. (exit 4)you confirmed at the terminal, but MAILCODED_ALLOW_MOVE is not set — the CLI is an agent surfaceMAILCODED_ALLOW_MOVE=1 mailcoded move ..., or use m in the TUI
This account has no folder marked as Archive.the server exposes no Archive rolemove --folder <name>
No folder called 'X'. This account has: ...a typo, or a folder that has not synced yetpick from the list; sync
A message can only move within its own account. (TUI)you picked a folder under another accountpick one under the same account
you are looking for deletethere is none, by designchapter 6

Raw SQL

You seeDo
Raw SQL reads require MAILCODED_ENABLE_SQL=1. (exit 4)set it, or use search, read and thread

Exit codes

CodeRetry?
0success
1internal errorreport it
2validation — bad argumentsfix the command
3not found — no such message, folder, account or draft
4forbidden — a safety gate refusedno; open the gate deliberately, or don’t
5rate limitedafter retry_after_ms
6confirm required — send needs a valid one-time tokenpreview again
7auth — the credential failed or is missingaccount reauth
8network — transientyes, with backoff
9store — the database is corrupt or full
10unsupported — the server or this build lacks a capability
130cancelled

Getting more detail

  • The daemon logs to stderr. When the TUI exits because the daemon died it prints what the daemon said; to drive the daemon by hand, mailcoded-daemon --log-level debug.
  • mailcoded health --json and mailcoded stats --json are the complete pictures.
  • mailcoded-tui --check proves the wire without a screen.

Starting over

A fresh sync from the server is always valid. mailcoded account forget --account <id> removes the local copy — including your local Tags and drafts for that account — and mailcoded setup re-adds it. If the store itself is damaged (exit 9), move the data directory aside and set up again; the server still has your mail.