rustdesk/rustdesk · error · anyhow::Error
Maximum number of terminal services ({}) reached
Error message
Maximum number of terminal services ({}) reached What it means
get_or_create_service hit the MAX_SERVICES cap: a new terminal service id was requested while that many persistent services already exist. This is a resource-limit guard (prevents unbounded per-user service accumulation), not an OS failure; the limit value is included in the message.
Source
Thrown at src/server/terminal_service.rs:171
}
true
}
pub fn is_service_specified_user(service_id: &str) -> Option<bool> {
get_service(service_id).map(|s| s.lock().unwrap().is_specified_user)
}
/// Get or create a persistent terminal service
fn get_or_create_service(
service_id: String,
is_persistent: bool,
is_specified_user: bool,
) -> Result<Arc<Mutex<PersistentTerminalService>>> {
let mut services = TERMINAL_SERVICES.lock().unwrap();
// Check service limit
if !services.contains_key(&service_id) && services.len() >= MAX_SERVICES {
return Err(anyhow!(
"Maximum number of terminal services ({}) reached",
MAX_SERVICES
));
}
let service = services
.entry(service_id.clone())
.or_insert_with(|| {
log::info!(
"Creating new terminal service: {} (persistent: {})",
service_id,
is_persistent
);
Arc::new(Mutex::new(PersistentTerminalService::new(
service_id.clone(),
is_persistent,
is_specified_user,
)))View on GitHub (pinned to 91c9fccbb0)
Solutions
- Close unused terminal sessions (they unregister their service) and retry
- If more concurrent terminals are genuinely needed, raise MAX_SERVICES and rebuild
- Check for leaked services: sessions stuck without proper Close/Closed handling keep slots occupied
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/server/terminal_service.rs:171 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10).
Data as JSON: /api/errors/4d40f62abb83bee6.
Report an issue: GitHub.