diff --git a/src/kobo/handlers.rs b/src/kobo/handlers.rs index eb72503..9a08f6f 100644 --- a/src/kobo/handlers.rs +++ b/src/kobo/handlers.rs @@ -347,12 +347,21 @@ impl KoboHandlers { ) -> Result { let user = resolve_user(&state, &auth_token).await?; - let book = state + let Some(book) = state .books .fetch_book_by_uuid(&book_uuid) .await .map_err(internal_error)? - .ok_or_else(|| (StatusCode::NOT_FOUND, "Book not found".to_string()))?; + else { + // The device is deleting a book that is not in our catalog (a + // sideloaded title, or a leftover from a prior library/server). + // DELETE is idempotent: the desired end state — "not on the + // server" — already holds, so acknowledge with 200. Returning 404 + // makes the device treat the delete as failed and retry it on + // every sync, producing an endless storm of failing requests. + info!(book_uuid = %book_uuid, "Delete for unknown book acknowledged"); + return Ok(StatusCode::OK); + }; state .app_db