{"record":{"id":"b956d290c1b73f5d","repo":"warpdotdev/warp","slug":"failed-to-delete-schedule","errorCode":null,"errorMessage":"Failed to delete schedule: {}","messagePattern":"Failed to delete schedule: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/ambient_agents/scheduled.rs","lineNumber":387,"sourceCode":"            Some(schedule) => {\n                if schedule.metadata().has_pending_online_only_change()\n                    || schedule.metadata().pending_changes_statuses.pending_delete\n                {\n                    let _ = tx.send(Err(anyhow::anyhow!(\n                        \"Cannot delete schedule with pending changes\"\n                    )));\n                } else {\n                    self.pending_deletes.insert(schedule_id, tx);\n                    UpdateManager::handle(ctx).update(ctx, |update_manager, ctx| {\n                        update_manager.delete_object_by_user(id_and_type, ctx);\n                    });\n                }\n            }\n        }\n\n        async move {\n            rx.await\n                .map_err(|e| anyhow::anyhow!(\"Failed to delete schedule: {}\", e))?\n        }\n    }\n}\n\nimpl Entity for ScheduledAgentManager {\n    type Event = ();\n}\n\nimpl SingletonEntity for ScheduledAgentManager {}\n","sourceCodeStart":369,"sourceCodeEnd":397,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/ambient_agents/scheduled.rs#L369-L397","documentation":"delete_schedule stores the oneshot sender in self.pending_deletes and the returned future awaits the receiver. If the sender is dropped without ever completing the channel - because the ScheduledAgentManager entity was dropped (app quit) or the sync path that resolves pending_deletes removed the entry without sending - rx.await returns RecvError ('channel closed'), which this message wraps.","triggerScenarios":"The pending_deletes entry keyed by schedule_id is dropped unresolved: app shutdown mid-delete, sync failure path that never sends on the stored tx, or the manager entity being recreated before the cloud delete acknowledgement arrives.","commonSituations":"Quitting Warp while a schedule deletion is awaiting server confirmation; connectivity loss where the delete ack never arrives and the channel is cleaned up; entity reset during logout/login while deletes are in flight.","solutions":["Retry delete_schedule after re-checking that the schedule still exists locally","Verify server-side state first: if the object was actually deleted, refresh instead of retrying","Ensure the app is not torn down while pending_deletes is non-empty (drain on shutdown)","Fix or report any sync code path that removes a pending_deletes entry without sending a result"],"exampleFix":"// before\nmanager.delete_schedule(schedule_id, ctx).await?;\n\n// after\nmatch manager.delete_schedule(schedule_id, ctx).await {\n    Ok(()) => Ok(()),\n    Err(e) if e.to_string().starts_with(\"Failed to delete schedule\") => {\n        // channel closed before the ack: verify and retry once\n        verify_schedule_gone_server_side(&schedule_id).await?;\n        manager.delete_schedule(schedule_id, ctx).await\n    }\n    Err(e) => Err(e),\n}","handlingStrategy":"retry","validationCode":"if manager.pending_deletes.contains_key(&schedule_id) {\n    // a delete is already awaiting its ack; don't start a second one\n}","typeGuard":null,"tryCatchPattern":"match manager.delete_schedule(id, ctx).await {\n    Err(e) if e.to_string().starts_with(\"Failed to delete schedule\") => {\n        verify_server_side_gone(&id).await; // avoid deleting a recreated schedule\n        manager.delete_schedule(id, ctx).await\n    }\n    other => other,\n}","preventionTips":["Drain or persist pending_deletes on shutdown instead of dropping the channels","Ensure every code path that removes a pending_deletes entry sends a final result","Keep the manager entity alive until in-flight cloud mutations resolve"],"tags":["rust","warp","cloud-sync","oneshot","async","ambient-agents"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}