{"record":{"id":"b4ed8d1f02aa2cd8","repo":"zed-industries/zed","slug":"failed-to-ring-user","errorCode":null,"errorMessage":"failed to ring user","messagePattern":"failed to ring user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/collab/src/rpc.rs","lineNumber":1803,"sourceCode":"                return Ok(());\n            }\n            Err(_) => {\n                call_response.trace_err();\n            }\n        }\n    }\n\n    {\n        let room = session\n            .db()\n            .await\n            .call_failed(room_id, called_user_id)\n            .await?;\n        room_updated(&room, &session.peer);\n    }\n    update_user_contacts(called_user_id, &session).await?;\n\n    Err(anyhow!(\"failed to ring user\"))?\n}\n\n/// Cancel an outgoing call.\nasync fn cancel_call(\n    request: proto::CancelCall,\n    response: Response<proto::CancelCall>,\n    session: MessageContext,\n) -> Result<()> {\n    let called_user_id = UserId::from_proto(request.called_user_id);\n    let room_id = RoomId::from_proto(request.room_id);\n    {\n        let room = session\n            .db()\n            .await\n            .cancel_call(room_id, session.connection_id, called_user_id)\n            .await?;\n        room_updated(&room, &session.peer);\n    }","sourceCodeStart":1785,"sourceCodeEnd":1821,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/collab/src/rpc.rs#L1785-L1821","documentation":"Terminal error from the call_user handler when every attempt to deliver the IncomingCall request to the called user's connections fails (FuturesUnordered of peer requests yields no Ok). Before returning, the handler compensates: it marks the call failed via call_failed, broadcasts room_updated, and updates contacts, so the room state is rolled back consistently. Empty connection sets also land here because there is nothing to succeed.","triggerScenarios":"Called user is fully offline (no active connections); all their connections are on servers unreachable from this one; their clients reject/timeout the IncomingCall request; transient network partition during ring delivery.","commonSituations":"Calling someone whose app is closed; cross-server routing broken during departs; user signed out on all devices; mobile push-only users with no live socket.","solutions":["Check the called user's online/presence state before placing the call and disable the button when offline","Retry the call after a short delay — the user may have just come online; refresh presence between attempts","Handle this error as 'unavailable' in the UI rather than a hard failure, since the room was already cleaned up"],"exampleFix":"// before\nclient.call_user(room_id, called_user_id, None).await?;\n\n// after (presence gate + friendly failure)\nif !presence.is_online(called_user_id) {\n    self.ui.show_toast(\"User is offline\");\n    return Ok(());\n}\nif let Err(err) = client.call_user(room_id, called_user_id, None).await {\n    if err.to_string().contains(\"failed to ring user\") {\n        self.ui.show_toast(\"Could not reach user; try again later\");\n        return Ok(());\n    }\n    return Err(err);\n}","handlingStrategy":"retry","validationCode":"// Presence gate before placing a call.\nif !presence.is_online(called_user_id) {\n    self.ui.show_toast(\"User is offline\");\n    return Ok(());\n}\nclient.call_user(room_id, called_user_id, None).await?;","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match client.call_user(room_id, called_user_id, None).await {\n        Ok(_) => return Ok(()),\n        Err(err) if err.to_string().contains(\"failed to ring user\") && attempt < 2 => {\n            smol::Timer::after(Duration::from_secs(2)).await; // user may come online\n        }\n        Err(err) => {\n            self.ui.show_toast(\"Could not reach user; try again later\");\n            return Ok(()); // room state was already rolled back server-side\n        }\n    }\n}","preventionTips":["Check presence/online state before showing the call button","Retry with backoff — the target may reconnect at any moment","Since the server already ran call_failed, resync room state after this error instead of assuming a live call"],"tags":["voice-calls","presence","offline","rpc","server"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}