{"record":{"id":"5e9462266bc002fe","repo":"Kuberwastaken/claurst","slug":"settings-sync-upload-unexpected-status","errorCode":null,"errorMessage":"Settings sync upload: unexpected status {}","messagePattern":"Settings sync upload: unexpected status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/core/src/settings_sync.rs","lineNumber":318,"sourceCode":"        debug!(count = changed.len(), \"Settings sync: uploading changed entries\");\r\n        self.put_entries(changed).await\r\n    }\r\n\r\n    async fn put_entries(&self, entries: HashMap<String, String>) -> Result<()> {\r\n        let body = serde_json::json!({ \"entries\": entries });\r\n        let resp = self\r\n            .http\r\n            .put(self.endpoint())\r\n            .header(\"Authorization\", format!(\"Bearer {}\", self.oauth_token))\r\n            .header(\"anthropic-beta\", \"oauth-2025-04-20\")\r\n            .header(\"Content-Type\", \"application/json\")\r\n            .json(&body)\r\n            .send()\r\n            .await?;\r\n\r\n        let status = resp.status().as_u16();\r\n        if !(200..300).contains(&status) {\r\n            anyhow::bail!(\"Settings sync upload: unexpected status {}\", status);\r\n        }\r\n        Ok(())\r\n    }\r\n\r\n    // -----------------------------------------------------------------------\r\n    // Fire-and-forget background upload (called from startup)\r\n    // -----------------------------------------------------------------------\r\n\r\n    /// Spawn a fire-and-forget upload task. Errors are logged but not propagated.\r\n    ///\r\n    /// Call this right after auth is established.  The task will:\r\n    ///   1. Read local settings and AGENTS.md files\r\n    ///   2. Fetch current remote state for diffing\r\n    ///   3. Upload only changed entries\r\n    pub fn upload_in_background(token: String, base_url: String) {\r\n        tokio::spawn(async move {\r\n            let mgr = SettingsSyncManager::new(token, base_url);\r\n            let entries = collect_local_entries(None).await;\r","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/core/src/settings_sync.rs#L300-L336","documentation":"The settings-sync PUT that uploads changed entries returned a non-success status — the formatted code is what the server answered with (e.g. 401 expired token, 409 conflict, 5xx). The batch of entries was not persisted server-side.","triggerScenarios":"Thrown at src-rust/crates/core/src/settings_sync.rs:318 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the upload; entries are keyed so re-PUTting the same batch is safe","Re-authenticate if the status indicates token expiry (401/403)","Check for conflicts if another device synced the same keys (409) and re-download first"],"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"}