{"record":{"id":"b932beefee3479d8","repo":"libnyanpasu/clash-nyanpasu","slug":"not-found","errorCode":null,"errorMessage":"{} not found","messagePattern":"(.+?) not found","errorType":"exception","errorClass":"std::io::Error (NotFound)","httpStatus":null,"severity":"critical","filePath":"backend/tauri/src/core/clash/mod.rs","lineNumber":20,"sourceCode":"use specta::Type;\nuse tauri_specta::Event;\n\npub mod api;\npub mod proxies;\npub mod ws;\n\n// TODO: support system path search via a config or flag\n// FIXME: move this fn to nyanpasu-utils\n/// Search the binary path of the core. See [`binary_candidates`] for the\n/// search locations and their priority.\npub fn find_binary_path(\n    core_type: &nyanpasu_utils::core::CoreType,\n) -> std::io::Result<std::path::PathBuf> {\n    binary_candidates(core_type)\n        .into_iter()\n        .find(|path| path.exists())\n        .ok_or_else(|| {\n            std::io::Error::new(\n                std::io::ErrorKind::NotFound,\n                format!(\"{} not found\", core_type.get_executable_name()),\n            )\n        })\n}\n\n/// Candidate core binary paths in priority order: data dir -> install dir.\n/// Dev builds additionally register the downloaded `externalBin` sidecars\n/// (`<crate>/sidecar/`): unlike `tauri build`, where the bundler copies the\n/// sidecars next to the executable stripping the target-triple suffix,\n/// `tauri dev` copies nothing, so neither the app's exe dir nor Tauri's own\n/// sidecar lookup can find the cores there.\nfn binary_candidates(core_type: &nyanpasu_utils::core::CoreType) -> Vec<std::path::PathBuf> {\n    let name = core_type.get_executable_name();\n    let mut candidates = Vec::new();\n    if let Ok(data_dir) = crate::utils::dirs::app_data_dir() {\n        candidates.push(data_dir.join(name));\n    }","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/core/clash/mod.rs#L2-L38","documentation":"`find_binary_path` searches the known candidate locations for a clash core binary (mihomo/clash, selected by `CoreType`). If none of the candidates exist on disk it throws `NotFound` with the core's executable name, meaning the required core binary was never downloaded or placed.","triggerScenarios":"Calling `find_binary_path(CoreType::Mihomo)` (or Clash) when no candidate path returned by `binary_candidates` exists — the sidecar binary is missing, was not bundled, or lives in a non-default install dir.","commonSituations":"Fresh install where `pnpm prepare:check`/sidecar download was skipped, antivirus quarantined the core binary, upgrading the app without re-downloading cores, or running from a source checkout without sidecar/ populated.","solutions":["Run the sidecar preparation step (e.g. `pnpm prepare:check`) to download the core binaries into backend/tauri/sidecar/.","Verify the binary exists at the expected location and the core type matches what was downloaded (mihomo vs clash).","Reinstall/repair the app so bundled sidecars are present.","Check that the install directory is writable and the binary was not quarantined."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let present = binary_candidates(&core_type).iter().any(|p| p.exists());\nif !present {\n    anyhow::bail!(\"core binary for {:?} missing; run sidecar setup\", core_type);\n}","typeGuard":null,"tryCatchPattern":"match find_binary_path(&core_type) {\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => prompt_core_download()?,\n    other => other?,\n}","preventionTips":["Run sidecar download (pnpm prepare:check) after checkout/install","Verify binaries exist at startup and show a download prompt","Watch for antivirus quarantine of core executables"],"tags":["rust","binary","sidecar","core","not-found"],"backgroundTag":"file-not-found","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}