toeverything/AFFiNE · error · napi::Error
GenericFailure
GenericFailure
Error message
Failed to read running applications
What it means
Raised in the napi-exported `applications` function when the std::sync::RwLock guarding the RUNNING_APPLICATIONS snapshot is poisoned — i.e. a writer thread panicked while holding the lock, leaving subsequent readers unable to acquire it. It is not a failure to enumerate processes; it signals internal corruption of the media-capture module's shared application-list state, so the caller cannot get any application list at all.
Source
Thrown at packages/frontend/native/media_capture/src/windows/screen_capture_kit.rs:196
}
#[napi(constructor)]
pub fn new() -> Self {
unsafe {
CoInitializeEx(None, COINIT_MULTITHREADED).ok().unwrap_or_else(|_| {
// COM initialization failed, but we can't return an error from
// constructor This is typically not fatal as COM might
// already be initialized
});
}
Self {}
}
#[napi]
pub fn applications() -> Result<Vec<ApplicationInfo>> {
let processes = RUNNING_APPLICATIONS
.read()
.map_err(|_| Error::new(Status::GenericFailure, "Failed to read running applications"))?;
let mut apps = Vec::new();
for &process_id in processes.iter() {
let name = get_process_name(process_id).unwrap_or_else(|| format!("Process {}", process_id));
if !name.is_empty() && name != format!("Process {}", process_id) {
let app_info = ApplicationInfo::new(process_id as i32, name, process_id);
apps.push(app_info);
}
}
Ok(apps)
}
#[napi]
pub fn application_with_process_id(process_id: u32) -> Option<ApplicationInfo> {
if is_process_running(process_id) {
let name = get_process_name(process_id).unwrap_or_else(|| format!("Process {}", process_id));
Some(ApplicationInfo::new(process_id as i32, name, process_id))
} else {View on GitHub (pinned to b4c8548c09)
Solutions
- Retry enumeration; grant the required system permissions.
- Restart the capture session.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Raised in the applications() napi getter when the RUNNING_APPLICATIONS lock is poisoned on Windows.
Common situations: A prior panic while holding the running-applications lock poisoned it. Restarting the app process clears the poisoned state.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/a71925d613019465.
Report an issue: GitHub.