{"record":{"id":"a26c8c7ca75a2434","repo":"BoundaryML/baml","slug":"e-log-collector","errorCode":null,"errorMessage":"{e:?}","messagePattern":"\\{e:\\?\\}","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"engine/language_client_ruby/ext/ruby_ffi/src/types/log_collector.rs","lineNumber":367,"sourceCode":"    }\n\n    pub fn duration_ms(&self) -> Option<i64> {\n        self.inner.duration_ms\n    }\n\n    pub fn define_in_ruby(module: &RModule) -> Result<()> {\n        let cls = module.define_class(\"Timing\", class::object())?;\n\n        cls.define_method(\"to_s\", method!(Timing::to_s, 0))?;\n        cls.define_method(\"start_time_utc_ms\", method!(Timing::start_time_utc_ms, 0))?;\n        cls.define_method(\"duration_ms\", method!(Timing::duration_ms, 0))?;\n\n        Ok(())\n    }\n\n    pub fn into_value(self, ruby: &Ruby) -> crate::Result<Value> {\n        serde_magnus::serialize(&self.inner)\n            .map_err(|e| Error::new(ruby.exception_runtime_error(), format!(\"{e:?}\")))\n    }\n}\n\nimpl StreamTiming {\n    pub fn to_s(&self) -> String {\n        format!(\n            \"StreamTiming(start_time_utc_ms={}, duration_ms={})\",\n            self.inner.start_time_utc_ms,\n            self.inner\n                .duration_ms\n                .map_or(\"null\".to_string(), |v| v.to_string())\n        )\n    }\n\n    pub fn start_time_utc_ms(&self) -> i64 {\n        self.inner.start_time_utc_ms\n    }\n","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_ruby/ext/ruby_ffi/src/types/log_collector.rs#L349-L385","documentation":"Raised by LogCollector (or its inner type) into_value when serde_magnus::serialize fails to turn the collector's inner Rust struct into a Ruby Value. The raw serde error is debug-formatted as the message of a Ruby RuntimeError. This means the log collector object could not be exposed to Ruby.","triggerScenarios":"Calling into_value on a LogCollector whose inner state contains data serde_magnus cannot map to Ruby (unexpected value shapes, incompatible baml version mixing), typically when retrieving a collector after function calls complete.","commonSituations":"Fetching collectors via Baml::Ffi after a streaming call where internal state holds a variant serde_magnus doesn't support; stale native extension after gem upgrade causing serde mismatches.","solutions":["Read the {e:?} payload for the exact field/serde failure.","Rebuild the native extension (gem pristine baml) to remove Rust/Ruby version mismatch.","Upgrade to the latest baml gem; collector serialization bugs are fixed periodically.","As a workaround, access collected data through collector logs/usage methods instead of the raw serialized object."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"raise 'native extension stale' unless File.exist?(Baml::Ffi.method(:new_collector).source_location rescue true)","typeGuard":"def collector_usable?(collector)\n  collector.respond_to?(:into_value) || collector.respond_to?(:logs)\nrescue StandardError\n  false\nend","tryCatchPattern":"begin\n  value = collector.into_value\nrescue RuntimeError => e\n  logger.warn(\"collector serialization failed: #{e.message}; using logs API\")\n  value = collector.logs\nend","preventionTips":["Rebuild the native extension after any baml gem upgrade.","Use the collector's typed accessor methods instead of raw serialization where possible.","Keep the baml gem at the latest patch version.","Guard collector retrieval code so a serialization failure doesn't crash response handling."],"tags":["ruby","serialization","logging","serde"],"backgroundTag":"json-serialization-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}