Kuberwastaken/claurst · error

Settings sync download: unexpected status

Error message

Settings sync download: unexpected status {}

What it means

The settings-sync GET (Bearer OAuth token, anthropic-beta oauth-2025-04-20) returned a status other than the handled 404/2xx — the formatted code is the unexpected status. Per the API contract errors should fail open: callers treat this as "no remote data" rather than a hard error.

Solutions

  1. Retry via download_with_retry; transient 5xx responses may succeed
  2. If 401/403, the OAuth token expired — re-authenticate and retry
  3. Treat local settings as authoritative until the sync endpoint recovers
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src-rust/crates/core/src/settings_sync.rs:163 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/018a68cb73e3229c. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/core/src/settings_sync.rs:163

    ///
    /// Returns `Ok(None)` when the server has no data for this user (404).
    /// Fails open — callers should treat errors as "no remote data".
    pub async fn download(&self) -> Result<Option<SyncedData>> {
        let resp = self
            .http
            .get(self.endpoint())
            .header("Authorization", format!("Bearer {}", self.oauth_token))
            .header("anthropic-beta", "oauth-2025-04-20")
            .send()
            .await?;

        let status = resp.status().as_u16();
        if status == 404 {
            debug!("Settings sync: no remote data (404)");
            return Ok(None);
        }
        if status != 200 {
            anyhow::bail!("Settings sync download: unexpected status {}", status);
        }

        let data: UserSyncData = resp.json().await?;
        Ok(Some(entries_to_synced_data(data.content.entries)))
    }

    /// Download with exponential-backoff retry.
    #[allow(dead_code)]
    async fn download_with_retry(&self) -> Result<Option<SyncedData>> {
        let mut last_err = anyhow::anyhow!("No attempts made");
        for attempt in 1..=(DEFAULT_MAX_RETRIES + 1) {
            match self.download().await {
                Ok(v) => return Ok(v),
                Err(e) => {
                    let msg = e.to_string();
                    // Auth failures are terminal
                    if msg.contains("401") || msg.contains("403") {
                        return Err(e);

View on GitHub (pinned to b0637c97ec)