{"record":{"id":"b723ec18fd3803e6","repo":"libnyanpasu/clash-nyanpasu","slug":"unsupported-core-type","errorCode":null,"errorMessage":"unsupported core type","messagePattern":"unsupported core type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/tauri/src/config/nyanpasu/mod.rs","lineNumber":131,"sourceCode":"            }\n        }\n    }\n}\n\nimpl TryFrom<&nyanpasu_utils::core::CoreType> for ClashCore {\n    type Error = anyhow::Error;\n\n    fn try_from(core: &nyanpasu_utils::core::CoreType) -> Result<Self> {\n        match core {\n            nyanpasu_utils::core::CoreType::Clash(clash) => match clash {\n                nyanpasu_utils::core::ClashCoreType::ClashPremium => Ok(ClashCore::ClashPremium),\n                nyanpasu_utils::core::ClashCoreType::ClashRust => Ok(ClashCore::ClashRs),\n                nyanpasu_utils::core::ClashCoreType::ClashRustAlpha => Ok(ClashCore::ClashRsAlpha),\n                nyanpasu_utils::core::ClashCoreType::Mihomo => Ok(ClashCore::Mihomo),\n                nyanpasu_utils::core::ClashCoreType::MihomoAlpha => Ok(ClashCore::MihomoAlpha),\n                nyanpasu_utils::core::ClashCoreType::Meow => Ok(ClashCore::Meow),\n            },\n            _ => Err(anyhow::anyhow!(\"unsupported core type\")),\n        }\n    }\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default, Type)]\n#[serde(rename_all = \"snake_case\")]\npub enum ProxiesSelectorMode {\n    Hidden,\n    #[default]\n    Normal,\n    Submenu,\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default, Type)]\n#[serde(rename_all = \"snake_case\")]\npub enum TunStack {\n    System,\n    #[default]","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/config/nyanpasu/mod.rs#L113-L149","documentation":"Thrown by the `TryFrom<&nyanpasu_utils::core::CoreType> for ClashCore` conversion in `config/nyanpasu/mod.rs` when the incoming `CoreType` is not the `CoreType::Clash(...)` variant. `ClashCore` only models Clash-family cores (ClashPremium, ClashRs, Mihomo, etc.), so any other core kind known to `nyanpasu_utils` (e.g. other core families added upstream) cannot be represented and the conversion fails.","triggerScenarios":"Calling `ClashCore::try_from(&core_type)` with a `CoreType` variant outside `CoreType::Clash`, e.g. a non-Clash core type introduced in a newer `nyanpasu-utils` version or obtained from a sidecar/service that reports an unexpected core family.","commonSituations":"Version skew: the utils crate gained a new CoreType enum variant while the app enum only knows Clash kinds; config or service data names a core the app does not support; code blindly converts a CoreType that came from external input.","solutions":["Check the `CoreType` variant before converting and handle non-Clash kinds explicitly.","Update both `nyanpasu-utils` and this enum together so the variant sets stay in sync.","Add explicit handling (skip/fallback to default core) for non-Clash core types at the call site.","Log the unsupported value with its Debug representation to identify which variant was missed."],"exampleFix":"// before\nlet core = ClashCore::try_from(&core_type)?;\n// after\nlet core = match &core_type {\n    nyanpasu_utils::core::CoreType::Clash(_) => ClashCore::try_from(&core_type)?,\n    other => {\n        log::warn!(\"unsupported core type: {other:?}\");\n        ClashCore::default()\n    }\n};","handlingStrategy":"type-guard","validationCode":"match core_type {\n    nyanpasu_utils::core::CoreType::Clash(_) => { /* safe to convert */ }\n    _ => anyhow::bail!(\"non-Clash core type not supported here\"),\n}","typeGuard":"fn is_clash_core(core: &nyanpasu_utils::core::CoreType) -> bool {\n    matches!(core, nyanpasu_utils::core::CoreType::Clash(_))\n}","tryCatchPattern":"let core = ClashCore::try_from(&core_type)\n    .with_context(|| format!(\"core type {core_type:?} is not a supported Clash core\"))\n    .unwrap_or(ClashCore::default());","preventionTips":["Match on CoreType::Clash before converting; never blindly TryFrom external input","Keep nyanpasu-utils and the ClashCore enum versions in sync","Add a test enumerating all CoreType variants against the conversion","Log the Debug form of unsupported variants for diagnosis"],"tags":["rust","enum","conversion","unsupported-variant"],"backgroundTag":"unsupported-enum-value","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"}