{"record":{"id":"3aa85ba1bab5f860","repo":"zed-industries/zed","slug":"contact-already-requested","errorCode":null,"errorMessage":"contact already requested","messagePattern":"contact already requested","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/collab/src/db/queries/contacts.rs","lineNumber":172,"sourceCode":"                        (contact::Column::ShouldNotify, false.into()),\n                    ])\n                    .action_and_where(\n                        contact::Column::Accepted.eq(false).and(\n                            contact::Column::AToB\n                                .eq(a_to_b)\n                                .and(contact::Column::UserIdA.eq(id_b))\n                                .or(contact::Column::AToB\n                                    .ne(a_to_b)\n                                    .and(contact::Column::UserIdA.eq(id_a))),\n                        ),\n                    )\n                    .to_owned(),\n            )\n            .exec_without_returning(&*tx)\n            .await?;\n\n            if rows_affected == 0 {\n                Err(anyhow!(\"contact already requested\"))?;\n            }\n\n            Ok(self\n                .create_notification(\n                    receiver_id,\n                    rpc::Notification::ContactRequest {\n                        sender_id: sender_id.to_proto(),\n                    },\n                    true,\n                    &tx,\n                )\n                .await?\n                .into_iter()\n                .collect())\n        })\n        .await\n    }\n","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/collab/src/db/queries/contacts.rs#L154-L190","documentation":"send_contact_request performs a conditional upsert on the contact row; this error fires when the update path matches an existing pending (not yet accepted) request in the opposite direction, meaning a contact request between the two users already exists and a duplicate cannot be created.","triggerScenarios":"Thrown at crates/collab/src/db/queries/contacts.rs:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Accept or dismiss the existing pending contact request instead of sending a new one","Have the other user respond to the outstanding request first"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}