{"record":{"id":"1f9a92e7ad39eb28","repo":"SeaQL/sea-orm","slug":"infallible","errorCode":null,"errorMessage":"Infallible","messagePattern":"Infallible","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"sea-orm-sync/src/driver/sqlx_postgres.rs","lineNumber":101,"sourceCode":"            }\n        }\n\n        if let Some(application_name) = &options.application_name {\n            sqlx_opts = sqlx_opts.application_name(application_name);\n        }\n\n        if let Some(timeout) = options.statement_timeout {\n            sqlx_opts = sqlx_opts.options([(\"statement_timeout\", timeout.as_millis().to_string())]);\n        }\n\n        if let Some(f) = &options.pg_opts_fn {\n            sqlx_opts = f(sqlx_opts);\n        }\n\n        let set_search_path_sql = options.schema_search_path.as_ref().map(|schema| {\n            let mut string = \"SET search_path = \".to_owned();\n            if schema.starts_with('\"') {\n                write!(&mut string, \"{schema}\").expect(\"Infallible\");\n            } else {\n                for (i, schema) in schema.split(',').enumerate() {\n                    if i > 0 {\n                        write!(&mut string, \",\").expect(\"Infallible\");\n                    }\n                    if schema.starts_with('\"') {\n                        write!(&mut string, \"{schema}\").expect(\"Infallible\");\n                    } else {\n                        write!(&mut string, \"\\\"{schema}\\\"\").expect(\"Infallible\");\n                    }\n                }\n            }\n            string\n        });\n\n        let lazy = options.connect_lazy;\n        let after_connect = options.after_connect.clone();\n        let pg_pool_opts_fn = options.pg_pool_opts_fn.clone();","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_postgres.rs#L83-L119","documentation":"This `.expect(\"Infallible\")` panics if `write!` to a String fails, which is impossible for the in-memory fmt::Write used here — it is an assertion of an internal invariant while building the `SET search_path = ...` statement in connect(). In practice it should never fire; seeing it means an unexpected formatting/capacity failure, so it signals a library bug rather than user error.","triggerScenarios":"Reached only if the `write!(&mut string, ...)` into the owned String in the schema_search_path handling of connect() somehow returns Err — theoretically impossible for String's fmt::Write impl; effectively unreachable.","commonSituations":"Practically never encountered by users; if observed it points to a patched toolchain, custom allocator/oom behavior during string growth, or a modified build of the driver code.","solutions":["Nothing actionable — this panic indicates a library-internal invariant break; file an issue with your schema_search_path value and versions.","As a workaround, pass a quoted schema (wrapped in double quotes) or avoid schema_search_path and set the search path manually after connecting."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The panic is unreachable; wrap connect() anyway if you must contain it:\nlet conn = std::panic::catch_unwind(|| Database::connect(opts.clone()))\n    .map_err(|_| DbErr::Custom(\"connect panicked building search_path\"))?","preventionTips":["Pass pre-quoted schema names (e.g. \"\\\"my schema\\\"\") in schema_search_path if unsure","Avoid exotic characters in schema names; quote them yourself","Report any occurrence to the maintainers — it indicates a library bug","Keep the library on a current, unmodified release build"],"tags":["postgres","search-path","internal","panic","unreachable"],"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"}