{"record":{"id":"956c48e339531d66","repo":"SeaQL/sea-orm","slug":"infallible-956c48","errorCode":null,"errorMessage":"Infallible","messagePattern":"Infallible","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/entity/identity.rs","lineNumber":79,"sourceCode":"\n    fn into_iter(self) -> Self::IntoIter {\n        OwnedIdentityIter {\n            identity: self,\n            index: 0,\n        }\n    }\n}\n\nimpl Iden for Identity {\n    fn quoted(&self) -> Cow<'static, str> {\n        match self {\n            Identity::Unary(iden) => iden.inner(),\n            Identity::Binary(iden1, iden2) => Cow::Owned(format!(\"{iden1}{iden2}\")),\n            Identity::Ternary(iden1, iden2, iden3) => Cow::Owned(format!(\"{iden1}{iden2}{iden3}\")),\n            Identity::Many(vec) => {\n                let mut s = String::new();\n                for iden in vec.iter() {\n                    write!(&mut s, \"{iden}\").expect(\"Infallible\");\n                }\n                Cow::Owned(s)\n            }\n        }\n    }\n\n    fn to_string(&self) -> String {\n        match self.quoted() {\n            Cow::Borrowed(s) => s.to_owned(),\n            Cow::Owned(s) => s,\n        }\n    }\n\n    fn unquoted(&self) -> &str {\n        panic!(\"Should not call this\")\n    }\n}\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/entity/identity.rs#L61-L97","documentation":"This panic comes from `.expect(\"Infallible\")` on a `write!` into an in-memory `String` inside `Identity:: Many` rendering in `src/entity/identity.rs:79`. Writing to a `String` via `fmt::Write` cannot fail (allocation failure aborts instead), so the panic is a defensive assertion on an infallible operation. It is effectively unreachable in normal use; if it ever fires, memory is exhausted or the `Display` impl of an identifier misbehaves.","triggerScenarios":"Rendering an `Identity::Many` column identity (e.g. composite primary keys used in `column_tuple_in_condition` or joined-key queries) when `write!` on the internal `String` returns `Err` — practically only under OOM or a buggy custom ` Iden` Display impl.","commonSituations":"Composite/multi-column primary keys or multi-column foreign keys being converted to string identity during query building; almost never hit by real applications.","solutions":["No fix needed — this branch is unreachable by construction; do not catch it.","If it fires, check for a custom `Iden`/identifier type whose `Display` implementation returns an error.","Reduce identifier/row batch sizes if memory pressure is the cause."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure identifiers implement Display and batches are bounded\nlet s: String = vec.iter().map(|i| i.to_string()).collect();\ndebug_assert!(!s.is_empty() || vec.is_empty());","typeGuard":"fn is_infallible_write(res: fmt::Result) -> bool { res.is_ok() }","tryCatchPattern":null,"preventionTips":["Do not wrap infallible String writes with catchable panics in app code.","Keep custom Iden Display impls error-free.","Keep the sea-orm version consistent across the workspace to avoid mismatched identifier types."],"tags":["internal-invariant","unreachable","formatting"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}