{"record":{"id":"72d6bbbb8ec0f084","repo":"rustdesk/rustdesk","slug":"no-session-with-peer-id","errorCode":null,"errorMessage":"No session with peer id {}","messagePattern":"No session with peer id (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/flutter.rs","lineNumber":1395,"sourceCode":"    }\n\n    if let Some(session) = sessions::get_session_by_session_id(session_id) {\n        let is_first_ui_session = session.session_handlers.read().unwrap().len() == 1;\n        if !is_connected && is_first_ui_session {\n            log::info!(\n                \"Session {} start, use texture render: {}\",\n                id,\n                session.use_texture_render.load(Ordering::Relaxed)\n            );\n            let session = (*session).clone();\n            std::thread::spawn(move || {\n                let round = session.connection_round_state.lock().unwrap().new_round();\n                io_loop(session, round);\n            });\n        }\n        Ok(())\n    } else {\n        bail!(\"No session with peer id {}\", id)\n    }\n}\n\n#[inline]\nfn try_send_close_event(event_stream: &Option<StreamSink<EventToUI>>) {\n    if let Some(stream) = &event_stream {\n        stream.add(EventToUI::Event(\"close\".to_owned()));\n    }\n}\n\n#[cfg(not(target_os = \"ios\"))]\npub fn update_text_clipboard_required() {\n    let is_required = sessions::get_sessions()\n        .iter()\n        .any(|s| s.is_default() && s.is_text_clipboard_required());\n    #[cfg(target_os = \"android\")]\n    let _ = scrap::android::ffi::call_clipboard_manager_enable_client_clipboard(is_required);\n    Client::set_is_text_clipboard_required(is_required);","sourceCodeStart":1377,"sourceCodeEnd":1413,"githubUrl":"https://github.com/rustdesk/rustdesk/blob/91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540/src/flutter.rs#L1377-L1413","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsession_start(&peer_id)?;\n// after\nif sessions::get_session_by_peer_id(&peer_id).is_some() {\n    session_start(&peer_id)?;\n}","handlingStrategy":"validation","validationCode":"// confirm the session exists before requesting a restart\nif sessions::get_session_by_peer_id(&peer_id).is_none() {\n    // re-create the session instead of restarting\n}","typeGuard":null,"tryCatchPattern":"match session_restart(&peer_id) {\n    Err(e) if e.to_string().starts_with(\"No session with peer id\") => session_add(&peer_id).and_then(|_| session_restart(&peer_id)),\n    other => other,\n}","preventionTips":["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"],"tags":["flutter","session","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540","analyzedAt":"2026-09-10T19:53:44.083Z","contentChangedAt":"2026-09-10T19:53:44.083Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}