libnyanpasu/clash-nyanpasu · error
unsupported core type
Error message
unsupported core type
What it means
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.
Source
Thrown at backend/tauri/src/config/nyanpasu/mod.rs:131
}
}
}
}
impl TryFrom<&nyanpasu_utils::core::CoreType> for ClashCore {
type Error = anyhow::Error;
fn try_from(core: &nyanpasu_utils::core::CoreType) -> Result<Self> {
match core {
nyanpasu_utils::core::CoreType::Clash(clash) => match clash {
nyanpasu_utils::core::ClashCoreType::ClashPremium => Ok(ClashCore::ClashPremium),
nyanpasu_utils::core::ClashCoreType::ClashRust => Ok(ClashCore::ClashRs),
nyanpasu_utils::core::ClashCoreType::ClashRustAlpha => Ok(ClashCore::ClashRsAlpha),
nyanpasu_utils::core::ClashCoreType::Mihomo => Ok(ClashCore::Mihomo),
nyanpasu_utils::core::ClashCoreType::MihomoAlpha => Ok(ClashCore::MihomoAlpha),
nyanpasu_utils::core::ClashCoreType::Meow => Ok(ClashCore::Meow),
},
_ => Err(anyhow::anyhow!("unsupported core type")),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default, Type)]
#[serde(rename_all = "snake_case")]
pub enum ProxiesSelectorMode {
Hidden,
#[default]
Normal,
Submenu,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default, Type)]
#[serde(rename_all = "snake_case")]
pub enum TunStack {
System,
#[default]View on GitHub (pinned to f7dbce2997)
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.
Example fix
// before
let core = ClashCore::try_from(&core_type)?;
// after
let core = match &core_type {
nyanpasu_utils::core::CoreType::Clash(_) => ClashCore::try_from(&core_type)?,
other => {
log::warn!("unsupported core type: {other:?}");
ClashCore::default()
}
}; Defensive patterns
Strategy: type-guard
Validate before calling
match core_type {
nyanpasu_utils::core::CoreType::Clash(_) => { /* safe to convert */ }
_ => anyhow::bail!("non-Clash core type not supported here"),
} Type guard
fn is_clash_core(core: &nyanpasu_utils::core::CoreType) -> bool {
matches!(core, nyanpasu_utils::core::CoreType::Clash(_))
} Try / catch
let core = ClashCore::try_from(&core_type)
.with_context(|| format!("core type {core_type:?} is not a supported Clash core"))
.unwrap_or(ClashCore::default()); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unimplemented!()
- IPC server is already initialized
- application actor call timed out
- clash config actor reply dropped
- clash config actor call timed out
AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08).
Data as JSON: /api/errors/b723ec18fd3803e6.
Report an issue: GitHub.