Hi @leojkwan! I’m Dosu and I’m helping the Tuist team.
Great write-up — I dug into the codebase and can confirm both issues you’ve identified.
Issue 1 — No graceful degradation on transient server errors:
The CLI currently distinguishes between “no token present” (proceeds in local-only mode) and “token present but server unavailable” (aborts). When POST /api/auth/refresh_token returns a 503, the RetryMiddleware retries it 3 times with exponential backoff [1]. After exhausting retries, the 503 is mapped to RefreshAuthTokenServiceError.unknownError(statusCode) [2], which is then converted to ClientAuthenticationError.notAuthenticated and thrown — aborting the command entirely [3]. The only network error that gets special handling is notConnectedToInternet; all other failures (including 503s) become hard auth errors [4]. So the local-only fallback path exists but is unreachable when a token is configured and the server is temporarily down.
Issue 2 — Misleading error message:
The message “Failed to retrieve cache endpoints due to an unknown server response of 503” actually does come from GetCacheEndpointsService [5], which is a separate call that also hits the server and also fails with 503. So the message is technically accurate for that request, but it’s confusing because the root cause is the upstream outage affecting auth and all other server calls — not a cache-specific problem. Surfacing the failing path and status (as you suggest) would make this much clearer.
There’s a related infrastructure-side discussion in #11955 about Kura region 503s during bootstrap, though that’s focused on the server side rather than CLI-side fallback behavior [6].
Your suggestion to degrade-with-warning (fall back to local cache, skip analytics, continue generating) when the server returns transient errors seems like a solid improvement — the capability is already there, it’s just gated on “no token” rather than “server unreachable.”
To reply, just mention @dosu.
Docs are dead. Just use Dosu.