{"record":{"id":"3ea5370521b16c5d","repo":"zed-industries/zed","slug":"no-such-contact-request","errorCode":null,"errorMessage":"no such contact request","messagePattern":"no such contact request","errorType":"validation","errorClass":"Error::Internal","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/contacts.rs","lineNumber":276,"sourceCode":"                    ..Default::default()\n                })\n                .filter(\n                    contact::Column::UserIdA\n                        .eq(id_a)\n                        .and(contact::Column::UserIdB.eq(id_b))\n                        .and(\n                            contact::Column::AToB\n                                .eq(a_to_b)\n                                .and(contact::Column::Accepted.eq(true))\n                                .or(contact::Column::AToB\n                                    .ne(a_to_b)\n                                    .and(contact::Column::Accepted.eq(false))),\n                        ),\n                )\n                .exec(&*tx)\n                .await?;\n            if result.rows_affected == 0 {\n                Err(anyhow!(\"no such contact request\"))?\n            } else {\n                Ok(())\n            }\n        })\n        .await\n    }\n\n    /// Accept or decline a contact request\n    pub async fn respond_to_contact_request(\n        &self,\n        responder_id: UserId,\n        requester_id: UserId,\n        accept: bool,\n    ) -> Result<NotificationBatch> {\n        self.transaction(|tx| async move {\n            let (id_a, id_b, a_to_b) = if responder_id < requester_id {\n                (responder_id, requester_id, false)\n            } else {","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/collab/src/db/queries/contacts.rs#L258-L294","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Only the request recipient may dismiss; the sender's row faces the other way\nif notification.recipient_id == my_id {\n    db.dismiss_contact_notification(my_id, contact_user_id).await?;\n}","typeGuard":null,"tryCatchPattern":"// Dismissing a notification whose contact row is gone is fine\nmatch db.dismiss_contact_notification(user_id, contact_user_id).await {\n    Ok(()) => Ok(()),\n    Err(err) if err.to_string().contains(\"no such contact request\") => Ok(()),\n    Err(err) => Err(err),\n}","preventionTips":["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"],"tags":["collab","contacts","notifications"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}