{"record":{"id":"018a68cb73e3229c","repo":"Kuberwastaken/claurst","slug":"settings-sync-download-unexpected-status","errorCode":null,"errorMessage":"Settings sync download: unexpected status {}","messagePattern":"Settings sync download: unexpected status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/core/src/settings_sync.rs","lineNumber":163,"sourceCode":"    ///\r\n    /// Returns `Ok(None)` when the server has no data for this user (404).\r\n    /// Fails open — callers should treat errors as \"no remote data\".\r\n    pub async fn download(&self) -> Result<Option<SyncedData>> {\r\n        let resp = self\r\n            .http\r\n            .get(self.endpoint())\r\n            .header(\"Authorization\", format!(\"Bearer {}\", self.oauth_token))\r\n            .header(\"anthropic-beta\", \"oauth-2025-04-20\")\r\n            .send()\r\n            .await?;\r\n\r\n        let status = resp.status().as_u16();\r\n        if status == 404 {\r\n            debug!(\"Settings sync: no remote data (404)\");\r\n            return Ok(None);\r\n        }\r\n        if status != 200 {\r\n            anyhow::bail!(\"Settings sync download: unexpected status {}\", status);\r\n        }\r\n\r\n        let data: UserSyncData = resp.json().await?;\r\n        Ok(Some(entries_to_synced_data(data.content.entries)))\r\n    }\r\n\r\n    /// Download with exponential-backoff retry.\r\n    #[allow(dead_code)]\r\n    async fn download_with_retry(&self) -> Result<Option<SyncedData>> {\r\n        let mut last_err = anyhow::anyhow!(\"No attempts made\");\r\n        for attempt in 1..=(DEFAULT_MAX_RETRIES + 1) {\r\n            match self.download().await {\r\n                Ok(v) => return Ok(v),\r\n                Err(e) => {\r\n                    let msg = e.to_string();\r\n                    // Auth failures are terminal\r\n                    if msg.contains(\"401\") || msg.contains(\"403\") {\r\n                        return Err(e);\r","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/core/src/settings_sync.rs#L145-L181","documentation":"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.","triggerScenarios":"Thrown at src-rust/crates/core/src/settings_sync.rs:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry via download_with_retry; transient 5xx responses may succeed","If 401/403, the OAuth token expired — re-authenticate and retry","Treat local settings as authoritative until the sync endpoint recovers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}