{"record":{"id":"3d6c055b24859f4b","repo":"diesel-rs/diesel","slug":"only-enums-are-supported-as-multiconnection-type","errorCode":null,"errorMessage":"Only enums are supported as multiconnection type","messagePattern":"Only enums are supported as multiconnection type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_derives/src/multiconnection.rs","lineNumber":65,"sourceCode":"\n                mod row {\n                    use super::*;\n                    #row\n                }\n\n                mod connection {\n                    use super::*;\n                    #connection\n                }\n\n                pub use self::backend::{MultiBackend, MultiRawValue};\n                pub use self::row::{MultiRow, MultiField};\n            }\n\n            pub use self::multi_connection_impl::{MultiBackend, MultiRow, MultiRawValue, MultiField};\n        }\n    } else {\n        panic!(\"Only enums are supported as multiconnection type\");\n    }\n}\n\n/// A helper struct containing common tokens used in the sync and async in similar.\nstruct MultiHelper {\n    is_async: bool,\n    /// Type of Connection trait.\n    conn: TokenStream,\n    /// Trait with the Backend Type.\n    conn_backend: TokenStream,\n    /// Trait implementing the load function.\n    conn_load: TokenStream,\n    /// The multi connection helper trait, used to cast to Any.\n    multi_conn_helper: TokenStream,\n    /// Type of the SimpleConnection trait.\n    simple_connection: TokenStream,\n    /// Type of the TransactionManager trait.\n    transaction_manager: TokenStream,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/multiconnection.rs#L47-L83","documentation":"Compile-time error in the #[multi_connection] attribute macro. The macro expects the annotated item to be an enum whose variants are the supported backend connections; it generates the MultiBackend/MultiRow plumbing only from that enum. It fires when the user applies #[diesel::multi_connection] to a struct, union, or other non-enum item, where no backend dispatch can be generated. Fix: annotate an enum listing one variant per backend connection.","triggerScenarios":"Thrown at diesel_derives/src/multiconnection.rs:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the type into an enum with one backend per variant","Apply the derive only to enum types","Use a single concrete connection type instead of a struct wrapper"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}