zed-industries/zed · error · Error::Internal
no such contact request
Error message
no such contact request
What it means
Thrown by dismiss_contact_notification (crates/collab/src/db/queries/contacts.rs:276): the UPDATE setting should_notify=false matched 0 rows. The filter requires the row to be directed toward the dismissing user — either an accepted contact the other user requested, or a pending request the other user sent. 0 rows means no such relationship exists in that direction (e.g. the dismisser is actually the original requester, or the contact was removed).
Source
Thrown at crates/collab/src/db/queries/contacts.rs:276
..Default::default()
})
.filter(
contact::Column::UserIdA
.eq(id_a)
.and(contact::Column::UserIdB.eq(id_b))
.and(
contact::Column::AToB
.eq(a_to_b)
.and(contact::Column::Accepted.eq(true))
.or(contact::Column::AToB
.ne(a_to_b)
.and(contact::Column::Accepted.eq(false))),
),
)
.exec(&*tx)
.await?;
if result.rows_affected == 0 {
Err(anyhow!("no such contact request"))?
} else {
Ok(())
}
})
.await
}
/// Accept or decline a contact request
pub async fn respond_to_contact_request(
&self,
responder_id: UserId,
requester_id: UserId,
accept: bool,
) -> Result<NotificationBatch> {
self.transaction(|tx| async move {
let (id_a, id_b, a_to_b) = if responder_id < requester_id {
(responder_id, requester_id, false)
} else {View on GitHub (pinned to bc538def45)
Solutions
- Only the notification's recipient (receiver of the request) should call dismiss — verify the rpc::Notification was addressed to this user before invoking
- Drop or locally clear stale notifications when the underlying contact is removed (remove_contact already clears one side's notification)
- Treat the error as benign when the contact row no longer exists
Defensive patterns
Strategy: try-catch
Validate before calling
// Only the request recipient may dismiss; the sender's row faces the other way
if notification.recipient_id == my_id {
db.dismiss_contact_notification(my_id, contact_user_id).await?;
} Try / catch
// Dismissing a notification whose contact row is gone is fine
match db.dismiss_contact_notification(user_id, contact_user_id).await {
Ok(()) => Ok(()),
Err(err) if err.to_string().contains("no such contact request") => Ok(()),
Err(err) => Err(err),
} Prevention
- Route dismiss calls only from the notification's addressee
- Clear stale contact notifications when remove_contact removes the relationship
- Pass (user_id = dismisser, contact_user_id = other party); do not swap the arguments
When it happens
Trigger: Calling dismiss for a ContactRequest notification where the caller was the sender (not the receiver); dismissing after the contact row was deleted by remove_contact; dismissing when the notification belongs to a different relationship state than the filter allows.
Common situations: Both users' clients reacting to the same notification event and the wrong one calling dismiss; stale notifications surviving a contact removal; UI passing the wrong user id (their own) as user_id.
Related errors
AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16).
Data as JSON: /api/errors/3ea5370521b16c5d.
Report an issue: GitHub.