SeaQL/sea-orm · info
Infallible
Error message
Infallible
What it means
In `Identity::quoted()` (the `to_string` path), `write!` into a `String` can only fail if the underlying formatter errors, which cannot happen for `String` targets — hence `.expect("Infallible")`. This is a standard Rust idiom for marking `fmt::Write` results as impossible to fail; it is effectively unreachable for library users.
Source
Thrown at sea-orm-sync/src/entity/identity.rs:79
fn into_iter(self) -> Self::IntoIter {
OwnedIdentityIter {
identity: self,
index: 0,
}
}
}
impl Iden for Identity {
fn quoted(&self) -> Cow<'static, str> {
match self {
Identity::Unary(iden) => iden.inner(),
Identity::Binary(iden1, iden2) => Cow::Owned(format!("{iden1}{iden2}")),
Identity::Ternary(iden1, iden2, iden3) => Cow::Owned(format!("{iden1}{iden2}{iden3}")),
Identity::Many(vec) => {
let mut s = String::new();
for iden in vec.iter() {
write!(&mut s, "{iden}").expect("Infallible");
}
Cow::Owned(s)
}
}
}
fn to_string(&self) -> String {
match self.quoted() {
Cow::Borrowed(s) => s.to_owned(),
Cow::Owned(s) => s,
}
}
fn unquoted(&self) -> &str {
panic!("Should not call this")
}
}
View on GitHub (pinned to e29bcd1b41)
Solutions
- No user action required; treat as an unreachable internal assertion.
- If ever observed, it indicates memory exhaustion — reduce memory pressure.
Defensive patterns
Strategy: try-catch
Try / catch
catch_unwind(|| identity.quoted()) // effectively unreachable; no handling needed
Prevention
- No action needed; this is an intentionally unreachable assertion.
When it happens
Trigger: Only reachable when stringifying an `Identity::Many` identifier. With `std::io::Write` this could fail on OOM/allocation failure, but for `String` formatting it is unconditionally successful.
Common situations: Practically never hit by users; would only surface under allocator failure during debug printing of identifiers.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Failed to get numeric array
- Failed to get oid
- Failed to get oid array
- Failed to get json
- Failed to get json array
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/505df435b8d2f56c.
Report an issue: GitHub.