{"record":{"id":"b8b8c0cf60a18769","repo":"nautechsystems/nautilus_trader","slug":"pluginerrorcode-panic","errorCode":"PluginErrorCode::Panic","errorMessage":"PluginError::panic(message)","messagePattern":"PluginError::panic\\(message\\)","errorType":"error_code","errorClass":"PluginError","httpStatus":null,"severity":"error","filePath":"crates/plugin/src/boundary.rs","lineNumber":342,"sourceCode":"    pub fn generic(message: impl AsRef<str>) -> Self {\n        Self {\n            code: PluginErrorCode::Generic,\n            message: OwnedBytes::from_vec(message.as_ref().as_bytes().to_vec()),\n        }\n    }\n\n    /// Constructs an error with the given code and message string.\n    #[must_use]\n    pub fn new(code: PluginErrorCode, message: impl AsRef<str>) -> Self {\n        Self {\n            code,\n            message: OwnedBytes::from_vec(message.as_ref().as_bytes().to_vec()),\n        }\n    }\n\n    /// Constructs a panic error with the given message.\n    #[must_use]\n    pub fn panic(message: impl AsRef<str>) -> Self {\n        Self::new(PluginErrorCode::Panic, message)\n    }\n\n    /// Returns the message as a `String` (lossy if non-UTF8).\n    #[must_use]\n    pub fn message_string(&self) -> String {\n        // SAFETY: message is live until self is dropped.\n        let bytes = unsafe { self.message.as_bytes() };\n        String::from_utf8_lossy(bytes).into_owned()\n    }\n}\n\nimpl core::fmt::Debug for PluginError {\n    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {\n        f.debug_struct(stringify!(PluginError))\n            .field(\"code\", &self.code)\n            .field(\"message\", &self.message_string())\n            .finish()","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/plugin/src/boundary.rs#L324-L360","documentation":"PluginError::panic is the plugin-boundary constructor that packages a panic payload (message string) into a PluginError carrying the panic code, so the failure crosses the FFI edge as an error value instead of unwinding across it.","triggerScenarios":"Thrown at crates/plugin/src/boundary.rs:342 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the packaged message for the original panic payload and location","Fix the panicking code path in the plugin and redeploy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}