rustdesk/rustdesk · error · anyhow::Error
Failed to get display {}, the displays' count is {}
Error message
Failed to get display {}, the displays' count is {} What it means
In test_create_capturer's retry loop, Display::all() returned fewer displays than the requested display_idx. The requested monitor does not currently exist (index out of range — displays enumerated while being reconfigured, or the index refers to a disconnected monitor).
Source
Thrown at src/server/video_service.rs:324
Capturer::new(display).with_context(|| "Failed to create capturer")?,
));
}
}
};
}
// This function works on privacy mode. Windows only for now.
pub fn test_create_capturer(
privacy_mode_id: i32,
display_idx: usize,
timeout_millis: u64,
) -> String {
let test_begin = Instant::now();
loop {
let err = match Display::all() {
Ok(mut displays) => {
if displays.len() <= display_idx {
anyhow!(
"Failed to get display {}, the displays' count is {}",
display_idx,
displays.len()
)
} else {
let display = displays.remove(display_idx);
match create_capturer(privacy_mode_id, display, display_idx, false) {
Ok(_) => return "".to_owned(),
Err(e) => e,
}
}
}
Err(e) => e.into(),
};
if test_begin.elapsed().as_millis() >= timeout_millis as _ {
return err.to_string();
}
std::thread::sleep(Duration::from_millis(300));View on GitHub (pinned to 91c9fccbb0)
Solutions
- Wait for display reconfiguration to settle — the loop retries until the timeout
- Re-enumerate displays and pick a valid index (typically 0 for primary)
- Verify the display index passed from the client matches the server's current monitor layout
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/server/video_service.rs:324 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/8ee2aa9d2f66d822.
Report an issue: GitHub.