rustdesk/rustdesk · error
No session with peer id {}
Error message
No session with peer id {} What it means
Raised in the Flutter session-restart/start path when no session exists for the given peer id. The lookup by peer id fails, so instead of spawning a new io_loop for the session the function bails with this message.
Source
Thrown at src/flutter.rs:1395
}
if let Some(session) = sessions::get_session_by_session_id(session_id) {
let is_first_ui_session = session.session_handlers.read().unwrap().len() == 1;
if !is_connected && is_first_ui_session {
log::info!(
"Session {} start, use texture render: {}",
id,
session.use_texture_render.load(Ordering::Relaxed)
);
let session = (*session).clone();
std::thread::spawn(move || {
let round = session.connection_round_state.lock().unwrap().new_round();
io_loop(session, round);
});
}
Ok(())
} else {
bail!("No session with peer id {}", id)
}
}
#[inline]
fn try_send_close_event(event_stream: &Option<StreamSink<EventToUI>>) {
if let Some(stream) = &event_stream {
stream.add(EventToUI::Event("close".to_owned()));
}
}
#[cfg(not(target_os = "ios"))]
pub fn update_text_clipboard_required() {
let is_required = sessions::get_sessions()
.iter()
.any(|s| s.is_default() && s.is_text_clipboard_required());
#[cfg(target_os = "android")]
let _ = scrap::android::ffi::call_clipboard_manager_enable_client_clipboard(is_required);
Client::set_is_text_clipboard_required(is_required);View on GitHub (pinned to 91c9fccbb0)
Solutions
- Re-create the session (session_add) before requesting a restart
- Verify the peer id used matches the id the session was registered under
- Guard the restart call with a session-existence check on the client side
Example fix
// before
session_start(&peer_id)?;
// after
if sessions::get_session_by_peer_id(&peer_id).is_some() {
session_start(&peer_id)?;
} Defensive patterns
Strategy: validation
Validate before calling
// confirm the session exists before requesting a restart
if sessions::get_session_by_peer_id(&peer_id).is_none() {
// re-create the session instead of restarting
} Try / catch
match session_restart(&peer_id) {
Err(e) if e.to_string().starts_with("No session with peer id") => session_add(&peer_id).and_then(|_| session_restart(&peer_id)),
other => other,
} Prevention
- Only call restart for sessions created in the same client run
- Re-add the session after any teardown before restarting
- Use the registered peer id, not a display alias
When it happens
Trigger: Calling session restart/start (which spawns the io_loop) with a peer id that has no registered session — e.g. the session was closed or was never added.
Common situations: Attempting to reconnect after the session was removed from the sessions map; caller uses the peer display id rather than the registered id; session closed on disconnect while a restart is still requested.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- No session with peer id {}, session id: {}
- same session id is found with different conn type?
- same session id is found
- file handle not found
- failed to get general pasteboard
AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10).
Data as JSON: /api/errors/72d6bbbb8ec0f084.
Report an issue: GitHub.