moghtech/komodo · error · anyhow::Error
Cannot insert Service type configuration as additional…
Error message
Cannot insert Service type configuration as additional login method.
What it means
UserConfig's update method inserts an additional login method for a user, but a Service-type configuration (API/service identity) cannot be added as an extra login method — only real user login variants are allowed. Inserting a UserConfig::Service returns this error and the map is left unmodified.
Solutions
- Pass a non-Service UserConfig variant (e.g. Password or OAuth) to update
- Handle Service configurations through the dedicated service-identity APIs instead of user login methods
- Guard the call site: match on the variant and skip/handle Service before calling update
Example fix
// before
user_config.update(UserConfig::Service { .. })?;
// after
match &login {
UserConfig::Service { .. } => { /* handle via service config API */ }
_ => user_config.update(login.clone())?,
} Defensive patterns
Strategy: type-guard
Validate before calling
if matches!(login, UserConfig::Service { .. }) {
return Err(anyhow!("Service config cannot be an additional login method"));
} Type guard
fn is_user_login(cfg: &UserConfig) -> bool { !matches!(cfg, UserConfig::Service { .. }) } Prevention
- Remember Service configs are service identities, not user login methods
- Pattern-match on UserConfig variants before mutating user login config
When it happens
Trigger: Calling user_config.update(UserConfig::Service { .. }) to add a Service config as an additional login method for a user.
Common situations: Misunderstanding which UserConfig variants are user login methods vs service identities; copying config-building code that constructs Service variants and passing it into update instead of a Password/OAuth variant.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Must attach either swarm or server
- Failed to log in |
- Socket closed before login
- Password cannot be empty.
AI-assisted analysis of moghtech/komodo@780ac68b99 (2026-09-08).
Data as JSON: /api/errors/826dfd111c6835bd.
Report an issue: GitHub.
Appendix: source
Thrown at client/core/rs/src/entities/user.rs:228
}
}
#[typeshare]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct LinkedLoginsMap(HashMap<UserConfigVariant, UserConfig>);
impl LinkedLoginsMap {
pub fn get(
&self,
variant: UserConfigVariant,
) -> Option<&UserConfig> {
self.0.get(&variant)
}
pub fn update(&mut self, login: UserConfig) -> anyhow::Result<()> {
if let UserConfig::Service { .. } = &login {
return Err(anyhow!(
"Cannot insert Service type configuration as additional login method."
));
}
self.0.insert((&login).into(), login);
Ok(())
}
pub fn remove(&mut self, variant: UserConfigVariant) {
self.0.remove(&variant);
}
}
#[typeshare]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct UserTotpConfig {
/// TOTP shared secret, encrypted
pub secret: String,View on GitHub (pinned to 780ac68b99)