{"record":{"id":"a71925d613019465","repo":"toeverything/AFFiNE","slug":"genericfailure-a71925","errorCode":"GenericFailure","errorMessage":"Failed to read running applications","messagePattern":"Failed to read running applications","errorType":"exception","errorClass":"napi::Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/native/media_capture/src/windows/screen_capture_kit.rs","lineNumber":196,"sourceCode":"  }\n\n  #[napi(constructor)]\n  pub fn new() -> Self {\n    unsafe {\n      CoInitializeEx(None, COINIT_MULTITHREADED).ok().unwrap_or_else(|_| {\n        // COM initialization failed, but we can't return an error from\n        // constructor This is typically not fatal as COM might\n        // already be initialized\n      });\n    }\n    Self {}\n  }\n\n  #[napi]\n  pub fn applications() -> Result<Vec<ApplicationInfo>> {\n    let processes = RUNNING_APPLICATIONS\n      .read()\n      .map_err(|_| Error::new(Status::GenericFailure, \"Failed to read running applications\"))?;\n\n    let mut apps = Vec::new();\n    for &process_id in processes.iter() {\n      let name = get_process_name(process_id).unwrap_or_else(|| format!(\"Process {}\", process_id));\n      if !name.is_empty() && name != format!(\"Process {}\", process_id) {\n        let app_info = ApplicationInfo::new(process_id as i32, name, process_id);\n        apps.push(app_info);\n      }\n    }\n    Ok(apps)\n  }\n\n  #[napi]\n  pub fn application_with_process_id(process_id: u32) -> Option<ApplicationInfo> {\n    if is_process_running(process_id) {\n      let name = get_process_name(process_id).unwrap_or_else(|| format!(\"Process {}\", process_id));\n      Some(ApplicationInfo::new(process_id as i32, name, process_id))\n    } else {","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/native/media_capture/src/windows/screen_capture_kit.rs#L178-L214","documentation":"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.","triggerScenarios":"Raised in the applications() napi getter when the RUNNING_APPLICATIONS lock is poisoned on Windows.","commonSituations":"A prior panic while holding the running-applications lock poisoned it. Restarting the app process clears the poisoned state.","solutions":["Retry enumeration; grant the required system permissions.","Restart the capture session."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}